Cod sursa(job #1709069)

Utilizator UTCN_heapstrUTCN HeapStr UTCN_heapstr Data 28 mai 2016 10:47:16
Problema Twoton Scor 0
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.59 kb
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>

using namespace std;

int main(){
	freopen("twoton.in", "r", stdin);
	freopen("twoton.out", "w", stdout);

	int n, a, b;
	int count = 0, pw = 1;
	scanf("%d", &n);

	scanf("%d", &a);

	for (int i = 1; i < n; i++) {
		scanf("%d", &b);
		count = (count + pw) % 19997;
		if (a >= b) {
			pw = (pw*2)%19997;
		}
		a = b;
	}
	count = (count + pw) % 19997;

	printf("%d\n", count);

	return 0;
}