Submission #1077202

#TimeUsernameProblemLanguageResultExecution timeMemory
1077202kwongwengBroken Device (JOI17_broken_device)C++17
0 / 100
28 ms3432 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long ll; typedef pair<int,int> ii; #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=a; i>=b; i--) #define pb push_back #define fi first #define se second void Anna( int N, long long X, int K, int P[] ){ vi pos(N); FOR(i,0,K) pos[P[i]]=1; for( int i = 0; i < N/2; i++ ){ if (pos[2*i]==1 || pos[2*i+1]==1 || X==0){ Set(2*i,0); Set(2*i+1,0); continue; } if (X%3==0){ Set(2*i,0); Set(2*i+1,1); } if (X%3==1){ Set(2*i,1); Set(2*i+1,0); } if (X%3==2){ Set(2*i,1); Set(2*i+1,1); } X /= 3; } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long ll; typedef pair<int,int> ii; #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=a; i>=b; i--) #define pb push_back #define fi first #define se second long long Bruno( int N, int A[] ){ ll val = 0; ll pos = 1; FOR(i,0,N/2){ int id = A[i*2]*2 + A[i*2+1]; if (id==0) continue; val += id * pos; pos *= 3; } return val; }
#Verdict Execution timeMemoryGrader output
Fetching results...