Submission #21130

#TimeUsernameProblemLanguageResultExecution timeMemory
21130khsoo01Broken Device (JOI17_broken_device)C++11
85 / 100
65 ms3736 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; bool cant[155]; void Anna( int N, long long X, int K, int P[] ){ for(int i=0;i<N;i++) cant[i] = false; for(int i=0;i<K;i++) cant[P[i]] = true; vector<int> tri; long long T = X; for(int i=0;i<38;i++) { tri.push_back(T%3+1); T /= 3; } reverse(tri.begin(), tri.end()); int idx = 0; for(int i=0;i<N;i+=2) { if(cant[i] || cant[i+1] || idx >= tri.size()) { Set(i, 0); Set(i+1, 0); } else { Set(i, tri[idx]/2); Set(i+1, tri[idx]%2); idx++; } } }
#include "Brunolib.h" long long Bruno( int N, int A[] ){ long long ret = 0; for(int i=0;i<N;i+=2) { int cur = A[i] * 2 + A[i+1]; if(!cur) continue; ret *= 3; ret += cur-1; } return ret; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(cant[i] || cant[i+1] || idx >= tri.size()) {
                                  ^



#Verdict Execution timeMemoryGrader output
Fetching results...