Submission #549109

# Submission time Handle Problem Language Result Execution time Memory
549109 2022-04-15T07:25:15 Z LucaDantas Broken Device (JOI17_broken_device) C++17
51 / 100
36 ms 2472 KB
#include "Annalib.h"
#include <bits/stdc++.h>

void Anna( int N, long long X, int K, int P[] ){
	int p[K+1];
	for(int i = 0; i < K; i++)
		p[i] = P[i];
	p[K] = N;

	std::vector<int> valor;
	while(X)
		valor.push_back(X % 2), X >>= 1;
	while(valor.size() % 2)
		valor.push_back(0);

	int id = 0, ptr = 0;
	for(int i = 0; i < N; i++) {
		if(p[id] < i) ++id;
		if(p[id] - i >= 3 && valor.size()) {
			Set(i, 1);
			for(int j = 1; j < 3; j++)
				Set(i+j, valor.back()), valor.pop_back();
			i += 2;
		} else
			Set(i, 0);
	}
}
#include "Brunolib.h"
#include <cstdio>

long long Bruno(int N, int A[]) {
	long long ans = 0;
	for(int i = 0; i < N; i++) {
		if(!A[i]) continue;
		for(int j = 1; j < 3; j++)
			ans <<= 1, ans |= A[i+j];
		i += 2;
	}
	return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:16:14: warning: unused variable 'ptr' [-Wunused-variable]
   16 |  int id = 0, ptr = 0;
      |              ^~~
# Verdict Execution time Memory Grader output
1 Partially correct 28 ms 2416 KB Output is partially correct - L* = 20
2 Partially correct 32 ms 2252 KB Output is partially correct - L* = 20
3 Partially correct 36 ms 2324 KB Output is partially correct - L* = 21
4 Partially correct 31 ms 2248 KB Output is partially correct - L* = 20
5 Partially correct 28 ms 2248 KB Output is partially correct - L* = 20
6 Partially correct 30 ms 2324 KB Output is partially correct - L* = 20
7 Partially correct 31 ms 2228 KB Output is partially correct - L* = 20
8 Partially correct 36 ms 2396 KB Output is partially correct - L* = 20
9 Partially correct 33 ms 2228 KB Output is partially correct - L* = 20
10 Partially correct 34 ms 2472 KB Output is partially correct - L* = 21
11 Partially correct 32 ms 2232 KB Output is partially correct - L* = 20
12 Partially correct 28 ms 2248 KB Output is partially correct - L* = 21
13 Partially correct 30 ms 2248 KB Output is partially correct - L* = 20
14 Partially correct 28 ms 2296 KB Output is partially correct - L* = 20
15 Partially correct 28 ms 2292 KB Output is partially correct - L* = 20
16 Partially correct 35 ms 2344 KB Output is partially correct - L* = 21
17 Partially correct 32 ms 2336 KB Output is partially correct - L* = 20
18 Partially correct 31 ms 2280 KB Output is partially correct - L* = 20
19 Partially correct 31 ms 2248 KB Output is partially correct - L* = 22
20 Partially correct 33 ms 2304 KB Output is partially correct - L* = 21
21 Partially correct 28 ms 2248 KB Output is partially correct - L* = 20
22 Partially correct 28 ms 2324 KB Output is partially correct - L* = 20
23 Partially correct 28 ms 2388 KB Output is partially correct - L* = 20
24 Partially correct 31 ms 2248 KB Output is partially correct - L* = 21
25 Partially correct 32 ms 2240 KB Output is partially correct - L* = 21
26 Partially correct 31 ms 2268 KB Output is partially correct - L* = 20
27 Partially correct 34 ms 2256 KB Output is partially correct - L* = 20
28 Partially correct 27 ms 2288 KB Output is partially correct - L* = 21
29 Partially correct 33 ms 2360 KB Output is partially correct - L* = 20
30 Partially correct 27 ms 2320 KB Output is partially correct - L* = 20
31 Partially correct 28 ms 2308 KB Output is partially correct - L* = 20
32 Partially correct 30 ms 2244 KB Output is partially correct - L* = 20
33 Partially correct 28 ms 2232 KB Output is partially correct - L* = 20
34 Partially correct 28 ms 2228 KB Output is partially correct - L* = 20
35 Partially correct 32 ms 2232 KB Output is partially correct - L* = 20
36 Partially correct 31 ms 2424 KB Output is partially correct - L* = 21
37 Partially correct 30 ms 2352 KB Output is partially correct - L* = 20
38 Partially correct 31 ms 2324 KB Output is partially correct - L* = 20
39 Partially correct 27 ms 2248 KB Output is partially correct - L* = 21
40 Partially correct 31 ms 2360 KB Output is partially correct - L* = 21