Submission #113952

# Submission time Handle Problem Language Result Execution time Memory
113952 2019-05-29T09:45:05 Z anayk Broken Device (JOI17_broken_device) C++14
0 / 100
2000 ms 384 KB
#include "Annalib.h"
#include <iostream>

#define LOGX 60

void Anna(int N, long long X, int K, int P[])
{
	int bin[LOGX];
	long long pow[LOGX];
	
	pow[0] = 1;
	for(int i = 1; i < LOGX; i++)
		pow[i] = pow[i-1]*2;
	
	for(int i = LOGX - 1; i >= 0; i++)
	{
		if(pow[i] <= X)
		{
			bin[i] = 1;
			X -= pow[i];
		}
		else
			bin[i] = 0;
	}
	
	int cur = 0;
	int ptr = 0;
	int next = 0;
	
	while(ptr < 60)
	{
		if(P[next] - cur < 3)
		{
			Set(cur, 0);
			cur++;
		}
		else
		{
			Set(cur, 1);
			cur++;
			for(int i = 0; i < 2; i++)
				Set(cur++, bin[ptr++]);
		}
		
		if(P[next] < cur)
			next++;
	}
	
	while(cur < N)
	{
		Set(cur, 0);
		cur++;
	}
}
#include "Brunolib.h"

#define LOGX 60

long long Bruno(int N, int A[])
{
	long long pow[LOGX];
	
	pow[0] = 1;
	for(int i = 1; i < LOGX; i++)
		pow[i] = pow[i-1]*2;
	
	long long X = 0;
	int cur = 0;
	for(int i = 0; i < N; i++)
	{
		if(A[i] == 1)
		{
			for(int j = 0; j < 2; j++)
				if(A[++i])
					X += pow[cur++];
		}
	}
	
	return X;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 384 KB Time limit exceeded
2 Execution timed out 2045 ms 384 KB Time limit exceeded
3 Execution timed out 2068 ms 384 KB Time limit exceeded
4 Execution timed out 2064 ms 384 KB Time limit exceeded
5 Execution timed out 2060 ms 384 KB Time limit exceeded
6 Execution timed out 2070 ms 384 KB Time limit exceeded
7 Execution timed out 2066 ms 384 KB Time limit exceeded
8 Execution timed out 2054 ms 256 KB Time limit exceeded
9 Execution timed out 2058 ms 384 KB Time limit exceeded
10 Execution timed out 2054 ms 256 KB Time limit exceeded
11 Execution timed out 2069 ms 256 KB Time limit exceeded
12 Execution timed out 2050 ms 256 KB Time limit exceeded
13 Execution timed out 2062 ms 256 KB Time limit exceeded
14 Execution timed out 2058 ms 256 KB Time limit exceeded
15 Execution timed out 2056 ms 256 KB Time limit exceeded
16 Execution timed out 2054 ms 256 KB Time limit exceeded
17 Execution timed out 2060 ms 256 KB Time limit exceeded
18 Execution timed out 2048 ms 384 KB Time limit exceeded
19 Execution timed out 2067 ms 384 KB Time limit exceeded
20 Execution timed out 2061 ms 256 KB Time limit exceeded
21 Execution timed out 2065 ms 384 KB Time limit exceeded
22 Execution timed out 2043 ms 256 KB Time limit exceeded
23 Execution timed out 2037 ms 256 KB Time limit exceeded
24 Execution timed out 2043 ms 256 KB Time limit exceeded
25 Execution timed out 2033 ms 256 KB Time limit exceeded
26 Execution timed out 2050 ms 256 KB Time limit exceeded
27 Execution timed out 2066 ms 256 KB Time limit exceeded
28 Execution timed out 2057 ms 256 KB Time limit exceeded
29 Execution timed out 2057 ms 256 KB Time limit exceeded
30 Execution timed out 2056 ms 384 KB Time limit exceeded
31 Execution timed out 2058 ms 256 KB Time limit exceeded
32 Execution timed out 2059 ms 384 KB Time limit exceeded
33 Execution timed out 2057 ms 384 KB Time limit exceeded
34 Execution timed out 2062 ms 384 KB Time limit exceeded
35 Execution timed out 2060 ms 256 KB Time limit exceeded
36 Execution timed out 2070 ms 256 KB Time limit exceeded
37 Execution timed out 2063 ms 384 KB Time limit exceeded
38 Execution timed out 2072 ms 384 KB Time limit exceeded
39 Execution timed out 2065 ms 384 KB Time limit exceeded
40 Execution timed out 2075 ms 256 KB Time limit exceeded