# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923982 | daoquanglinh2007 | Broken Device (JOI17_broken_device) | C++17 | 1 ms | 1048 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
const int g[] = {45, 39, 34, 16, 24, 55, 54, 63, 19, 44, 41, 70, 61, 29, 57, 12, 72, 53, 42, 69, 48, 15, 11, 28, 66, 50, 17, 62, 58, 74, 35, 9, 68, 30, 45, 21, 47, 23, 5, 67, 41, 12, 14, 6, 17, 22, 47, 27, 49, 43, 37, 5, 20, 0, 73, 22, 11, 57, 52, 72, 63, 62, 54, 74, 13, 26, 73, 7, 31, 64, 66, 33, 30, 10, 37, 28, 64, 2, 56, 51, 53, 50, 25, 52, 71, 27, 32, 1, 7, 16, 20, 56, 71, 65, 58, 24, 3, 42, 67, 65, 38, 36, 55, 8, 10, 29, 0, 14, 46, 25, 6, 34, 43, 39, 4, 46, 15, 19, 2, 44, 32, 59, 18, 38, 59, 33, 61, 4, 8, 40, 9, 21, 31, 60, 51, 40, 1, 48, 68, 23, 36, 18, 26, 13, 3, 35, 70, 49, 69, 60};
int f[75][2], cur[75];
bool block[150], ok[150];
void Anna(int N, long long X, int K, int P[]){
for (int i = 0; i < 150; i++){
f[g[i]][cur[g[i]]] = i;
cur[g[i]]++;
}
memset(block, 0, sizeof(block));
memset(ok, 0, sizeof(ok));
for (int i = 0; i < K; i++) block[P[i]] = 1;
for (int i = 0; i < 75; i++){
int a = X%3+1, b = 0;
if (!block[f[i][0]]) b++;
if (!block[f[i][1]]) b += 2;
if ((a&b) == a){
Set(f[i][0], a&1);
Set(f[i][1], (a&2)>>1);
ok[f[i][0]] = 1;
ok[f[i][1]] = 1;
X /= 3;
if (X == 0) break;
}
}
for (int i = 0; i < 150; i++)
if (!ok[i]) Set(i, 0);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
const int g[] = {45, 39, 34, 16, 24, 55, 54, 63, 19, 44, 41, 70, 61, 29, 57, 12, 72, 53, 42, 69, 48, 15, 11, 28, 66, 50, 17, 62, 58, 74, 35, 9, 68, 30, 45, 21, 47, 23, 5, 67, 41, 12, 14, 6, 17, 22, 47, 27, 49, 43, 37, 5, 20, 0, 73, 22, 11, 57, 52, 72, 63, 62, 54, 74, 13, 26, 73, 7, 31, 64, 66, 33, 30, 10, 37, 28, 64, 2, 56, 51, 53, 50, 25, 52, 71, 27, 32, 1, 7, 16, 20, 56, 71, 65, 58, 24, 3, 42, 67, 65, 38, 36, 55, 8, 10, 29, 0, 14, 46, 25, 6, 34, 43, 39, 4, 46, 15, 19, 2, 44, 32, 59, 18, 38, 59, 33, 61, 4, 8, 40, 9, 21, 31, 60, 51, 40, 1, 48, 68, 23, 36, 18, 26, 13, 3, 35, 70, 49, 69, 60};
int f[75][2], cur[75];
long long Bruno(int N, int A[]){
for (int i = 0; i < 150; i++){
f[g[i]][cur[g[i]]] = i;
cur[g[i]]++;
}
long long X = 0;
for (int i = 74; i >= 0; i--){
if (A[f[i][0]] == 0 && A[f[i][1]] == 0) continue;
int tmp = A[f[i][0]]+A[f[i][1]]*2-1;
X = X*3+tmp;
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |