제출 #1188478

#제출 시각아이디문제언어결과실행 시간메모리
1188478SofiatpcBroken Device (JOI17_broken_device)C++20
45 / 100
26 ms1576 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; static int marc[155]; void Anna( int n, long long x, int k, int p[] ){ mt19937 mt(5); for(int i = 0; i < n; i++)marc[i] = 0; for(int i = 0; i < k; i++)marc[p[i]] = 1; long long po = 1; for(int i = 2; i < n; i+=3){ int v010 = mt()%4, v101 = mt()%4, v111 = mt()%4; int val = ((x&po)>0) + ((( x&(po*2))>0)<<1); if(marc[i] == 0 && marc[i-1] == 0 && marc[i-2] == 1){ //x__ if(v010 == val){ Set(i-2, 0); Set(i-1, 1); Set(i, 0); po*=4; }else if(x & po){ Set(i-2, 0); Set(i-1, 1); Set(i, 1); po*=2; }else{ Set(i-2, 0); Set(i-1, 0); Set(i, 1); po*=2; } } else if(marc[i] == 0 && marc[i-1] == 1 && marc[i-2] == 0){//_x_ if(v101 == val){ Set(i-2, 1); Set(i-1, 0); Set(i, 1); po*=4; }else if(x & po){ Set(i-2, 1); Set(i-1, 0); Set(i, 0); po*=2; }else{ Set(i-2, 0); Set(i-1, 0); Set(i, 1); po*=2; } } else if(marc[i] == 1 && marc[i-1] == 0 && marc[i-2] == 0){//__x if(v010 == val){ Set(i-2, 0); Set(i-1, 1); Set(i, 0); po*=4; }else if(x & po){ Set(i-2, 1); Set(i-1, 0); Set(i, 0); po*=2; }else{ Set(i-2, 1); Set(i-1, 1); Set(i, 0); po*=2; } }else if(marc[i] == 0 && marc[i-1] == 0 && marc[i-2] == 0){//___ if(v010 == val){ Set(i-2, 0); Set(i-1, 1); Set(i, 0); po*=4; }else if(v101 == val){ Set(i-2, 1); Set(i-1, 0); Set(i, 1); po*=4; }else if(v111 == val){ Set(i-2, 1); Set(i-1, 1); Set(i, 1); po*=4; }else if(x & po){ Set(i-2, 1); Set(i-1, 0); Set(i, 0); po*=2; }else{ Set(i-2, 1); Set(i-1, 1); Set(i, 0); po*=2; } }else{ Set(i-2, 0); Set(i-1, 0); Set(i, 0); } } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; long long Bruno( int n, int a[] ){ mt19937 mt(5); long long x = 0, p = 1; for(int i = 2; i < n; i+=3){ int v010 = mt()%4, v101 = mt()%4, v111 = mt()%4; if(a[i-2] == 0 && a[i-1] == 0 && a[i] == 1){ p*=2; }else if(a[i-2] == 0 && a[i-1] == 1 && a[i] == 1){ x += p; p*=2; }else if(a[i-2] == 1 && a[i-1] == 0 && a[i] == 0){ x += p; p*=2; }else if(a[i-2] == 1 && a[i-1] == 1 && a[i] == 0){ p*=2; }else if(a[i-2] == 0 && a[i-1] == 1 && a[i] == 0){ x += v010*p; p*=4; }else if(a[i-2] == 1 && a[i-1] == 0 && a[i] == 1){ x += v101*p; p*=4; }else if(a[i-2] == 1 && a[i-1] == 1 && a[i] == 1){ x += v111*p; p*=4; } } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...