Submission #1077163

#TimeUsernameProblemLanguageResultExecution timeMemory
1077163AMO5Broken Device (JOI17_broken_device)C++17
0 / 100
1 ms1056 KiB
#include "Annalib.h" #include "bits/stdc++.h" void Anna( int N, long long X, int K, int P[] ){ std::vector<int>bad(N, 0); for(int i=0; i<K; i++)bad[P[i]]=1; long long tmp = X; for(int i=0; i<N; i++){ if(bad[i] || (i + 1 < N && bad[i+1]) || tmp == 0){ Set(i, 0); }else{ int bit = tmp % 2; Set(i, 1); Set(i+1, bit); i++; tmp /= 2; } } }
#include "Brunolib.h" #include "bits/stdc++.h" long long Bruno( int N, int A[] ){ std::vector<int>bits; for(int i=0; i<N; i++){ if(A[i] == 0)continue; else{ bits.emplace_back(A[i+1]); i++; } } long long answer = 0LL; while(!bits.empty()){ answer *= 2LL; answer += bits.back(); bits.pop_back(); } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...