#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static int a[] = {107,20,63,15,106,41,147,91,77,60,141,9,2,139,128,133,132,94,118,105,21,119,48,61,57,87,35,23,82,75,98,55,62,34,131,145,142,29,78,30,99,113,89,76,84,26,32,45,66,28,80,24,83,19,36,38,92,18,54,93,79,125,13,27,116,49,58,140,4,112,135,111,31,53,123,70,73,11,138,110,39,104,129,126,74,115,69,59,42,130,90,16,95,1,47,46,43,8,25,72,52,120,146,71,7,5,96,51,144,85,68,114,65,64,148,109,56,50,37,108,10,117,86,33,17,102,103,40,88,67,149,14,122,136,97,143,81,127,124,121,22,100,0,3,101,6,134,12,137,44};
void Anna( int N, long long X, int K, int P[] ){
bool chk[150] = {0};
for (int i=0;i<K;i++) chk[P[i]] = 1;
for (int i=0;i<150;i+=2){
if (chk[a[i]] && chk[a[i+1]]) {Set(a[i], 0); Set(a[i+1], 0);}
else if (chk[a[i]]){
if (X%3==0) {Set(a[i], 0); Set(a[i+1], 1); X /= 3;}
else {Set(a[i], 0); Set(a[i+1], 0);}
}
else if (chk[a[i+1]]){
if (X%3==1) {Set(a[i], 1); Set(a[i+1], 0); X /= 3;}
else {Set(a[i], 0); Set(a[i+1], 0);}
}
else {
if (X%3==0) {Set(a[i], 0); Set(a[i+1], 1);}
else if (X%3==1) {Set(a[i], 1); Set(a[i+1], 0);}
else {Set(a[i], 1); Set(a[i+1], 1);}
X /= 3;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static int a[] = {107,20,63,15,106,41,147,91,77,60,141,9,2,139,128,133,132,94,118,105,21,119,48,61,57,87,35,23,82,75,98,55,62,34,131,145,142,29,78,30,99,113,89,76,84,26,32,45,66,28,80,24,83,19,36,38,92,18,54,93,79,125,13,27,116,49,58,140,4,112,135,111,31,53,123,70,73,11,138,110,39,104,129,126,74,115,69,59,42,130,90,16,95,1,47,46,43,8,25,72,52,120,146,71,7,5,96,51,144,85,68,114,65,64,148,109,56,50,37,108,10,117,86,33,17,102,103,40,88,67,149,14,122,136,97,143,81,127,124,121,22,100,0,3,101,6,134,12,137,44};
long long Bruno( int N, int A[] ){
ll ans = 0;
for (int i=148;i>=0;i-=2){
if (!A[a[i]] && !A[a[i+1]]) continue;
ans *= 3;
if (A[a[i]]==0 && A[a[i+1]]==1) ans += 0;
else if (A[a[i]]==1 && A[a[i+1]]==0) ans += 1;
else ans += 2;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
2300 KB |
Output is correct - L* = 40 |
2 |
Correct |
28 ms |
2236 KB |
Output is correct - L* = 40 |
3 |
Correct |
31 ms |
2296 KB |
Output is correct - L* = 40 |
4 |
Correct |
33 ms |
2228 KB |
Output is correct - L* = 40 |
5 |
Correct |
32 ms |
2308 KB |
Output is correct - L* = 40 |
6 |
Correct |
31 ms |
2204 KB |
Output is correct - L* = 40 |
7 |
Correct |
28 ms |
2224 KB |
Output is correct - L* = 40 |
8 |
Correct |
30 ms |
2280 KB |
Output is correct - L* = 40 |
9 |
Correct |
29 ms |
2304 KB |
Output is correct - L* = 40 |
10 |
Correct |
28 ms |
2324 KB |
Output is correct - L* = 40 |
11 |
Correct |
28 ms |
2324 KB |
Output is correct - L* = 40 |
12 |
Correct |
28 ms |
2156 KB |
Output is correct - L* = 40 |
13 |
Correct |
28 ms |
2216 KB |
Output is correct - L* = 40 |
14 |
Correct |
39 ms |
2276 KB |
Output is correct - L* = 40 |
15 |
Correct |
34 ms |
2432 KB |
Output is correct - L* = 40 |
16 |
Correct |
28 ms |
2372 KB |
Output is correct - L* = 40 |
17 |
Correct |
28 ms |
2312 KB |
Output is correct - L* = 40 |
18 |
Correct |
28 ms |
2272 KB |
Output is correct - L* = 40 |
19 |
Correct |
28 ms |
2236 KB |
Output is correct - L* = 40 |
20 |
Correct |
28 ms |
2224 KB |
Output is correct - L* = 40 |
21 |
Correct |
28 ms |
2320 KB |
Output is correct - L* = 40 |
22 |
Correct |
30 ms |
2328 KB |
Output is correct - L* = 40 |
23 |
Correct |
28 ms |
2280 KB |
Output is correct - L* = 40 |
24 |
Correct |
38 ms |
2328 KB |
Output is correct - L* = 40 |
25 |
Correct |
30 ms |
2316 KB |
Output is correct - L* = 40 |
26 |
Correct |
30 ms |
2224 KB |
Output is correct - L* = 40 |
27 |
Correct |
28 ms |
2208 KB |
Output is correct - L* = 40 |
28 |
Correct |
30 ms |
2200 KB |
Output is correct - L* = 40 |
29 |
Correct |
28 ms |
2220 KB |
Output is correct - L* = 40 |
30 |
Correct |
31 ms |
2204 KB |
Output is correct - L* = 40 |
31 |
Correct |
30 ms |
2248 KB |
Output is correct - L* = 40 |
32 |
Correct |
28 ms |
2236 KB |
Output is correct - L* = 40 |
33 |
Correct |
30 ms |
2292 KB |
Output is correct - L* = 40 |
34 |
Correct |
30 ms |
2288 KB |
Output is correct - L* = 40 |
35 |
Correct |
30 ms |
2324 KB |
Output is correct - L* = 40 |
36 |
Correct |
30 ms |
2312 KB |
Output is correct - L* = 40 |
37 |
Correct |
31 ms |
2288 KB |
Output is correct - L* = 40 |
38 |
Correct |
28 ms |
2264 KB |
Output is correct - L* = 40 |
39 |
Correct |
35 ms |
2248 KB |
Output is correct - L* = 40 |
40 |
Correct |
40 ms |
2292 KB |
Output is correct - L* = 40 |