# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530901 | qwerasdfzxcl | Broken Device (JOI17_broken_device) | C++14 | 40 ms | 2432 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;
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |