Submission #310989

#TimeUsernameProblemLanguageResultExecution timeMemory
310989peuchBroken Device (JOI17_broken_device)C++17
8 / 100
46 ms3584 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; void Anna(int N, long long X, int K, int P[]){ int marc[N + 10]; int on[N + 10]; memset(marc, 0, sizeof(marc)); memset(on, 0, sizeof(on)); for(int i = 0; i < K; i++) marc[P[i]] = 1; int it1 = 60, it2 = N - 1; for(; it1 >= 0; it1--){ while((marc[it2] || marc[it2 - 1]) && it2 > 1) { // Set(it2, 0); it2--; if(it2 < 0) break; } // Set(it2, 1); on[it2] = 1; it2--; if(it2 < 0) break; if((1LL << ((long long)it1)) & X) on[it2] = 1; // Set(it2, 1); it2--; if(it2 < 0) break; } for(int i = 0; i < N; i++){ Set(i, on[i]); } return; }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; long long Bruno(int N, int A[]){ int it1 = 60, it2 = N - 1; long long ret = 0; for(; it2 > 0; it2--){ if(A[it2]){ it2--; ret |= ((long long) A[it2]) << (long long)it1; it1--; } if(it1 < 0) break; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...