Submission #69067

# Submission time Handle Problem Language Result Execution time Memory
69067 2018-08-19T18:31:57 Z IvanC Broken Device (JOI17_broken_device) C++17
0 / 100
2000 ms 1536 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 210;
const int MAXL = 60;

static int possivel[MAXN][2],resposta[MAXN];

void Anna( int N, long long X, int K, int P[] ){

	memset(possivel,1,sizeof(possivel));

	for(int i = 0;i<K;i++){
		possivel[P[i]][1] = 0;
	}

	int last = 0,ptr = 0;
	while(last < MAXL && ptr < N){
		if(!possivel[ptr][1]){
			ptr++;
		}
		else{
			long long digito = (X & (1LL << last));
			if(digito){
				if(possivel[ptr+1][1]){
					resposta[ptr] = 1;
					resposta[ptr+1] = 1;
					last++;
					ptr += 2;
				}
			}
			else{
				resposta[ptr] = 1;
				resposta[ptr+1] = 0;
				last++;
				ptr += 2;
			}
		}
	}

	for(int i =0;i<N;i++){
		Set( i, resposta[i] );
	}

}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){

	long long ans = 0;
	int last = 0;
	int i = 0;

	while(i < N){
		if(A[i] == 1){
			ans += (A[i+1])*(1LL << last);
			last++;
			i += 2;
		}
		else{
			i++;
		}
	}

	return ans;

}
# Verdict Execution time Memory Grader output
1 Execution timed out 2095 ms 376 KB Time limit exceeded
2 Execution timed out 2064 ms 484 KB Time limit exceeded
3 Execution timed out 2064 ms 568 KB Time limit exceeded
4 Execution timed out 2065 ms 584 KB Time limit exceeded
5 Execution timed out 2058 ms 668 KB Time limit exceeded
6 Execution timed out 2061 ms 684 KB Time limit exceeded
7 Execution timed out 2071 ms 704 KB Time limit exceeded
8 Execution timed out 2073 ms 828 KB Time limit exceeded
9 Execution timed out 2073 ms 900 KB Time limit exceeded
10 Execution timed out 2070 ms 1036 KB Time limit exceeded
11 Execution timed out 2063 ms 1156 KB Time limit exceeded
12 Execution timed out 2060 ms 1156 KB Time limit exceeded
13 Execution timed out 2060 ms 1156 KB Time limit exceeded
14 Execution timed out 2060 ms 1156 KB Time limit exceeded
15 Execution timed out 2068 ms 1156 KB Time limit exceeded
16 Execution timed out 2069 ms 1156 KB Time limit exceeded
17 Execution timed out 2066 ms 1168 KB Time limit exceeded
18 Execution timed out 2069 ms 1184 KB Time limit exceeded
19 Execution timed out 2077 ms 1204 KB Time limit exceeded
20 Execution timed out 2080 ms 1216 KB Time limit exceeded
21 Execution timed out 2075 ms 1232 KB Time limit exceeded
22 Execution timed out 2068 ms 1248 KB Time limit exceeded
23 Execution timed out 2097 ms 1264 KB Time limit exceeded
24 Execution timed out 2080 ms 1280 KB Time limit exceeded
25 Execution timed out 2083 ms 1296 KB Time limit exceeded
26 Execution timed out 2079 ms 1312 KB Time limit exceeded
27 Execution timed out 2082 ms 1328 KB Time limit exceeded
28 Execution timed out 2077 ms 1344 KB Time limit exceeded
29 Execution timed out 2081 ms 1360 KB Time limit exceeded
30 Execution timed out 2079 ms 1376 KB Time limit exceeded
31 Execution timed out 2070 ms 1392 KB Time limit exceeded
32 Execution timed out 2081 ms 1408 KB Time limit exceeded
33 Execution timed out 2074 ms 1424 KB Time limit exceeded
34 Execution timed out 2082 ms 1440 KB Time limit exceeded
35 Execution timed out 2082 ms 1456 KB Time limit exceeded
36 Execution timed out 2063 ms 1472 KB Time limit exceeded
37 Execution timed out 2078 ms 1488 KB Time limit exceeded
38 Execution timed out 2076 ms 1504 KB Time limit exceeded
39 Execution timed out 2066 ms 1520 KB Time limit exceeded
40 Execution timed out 2057 ms 1536 KB Time limit exceeded