Submission #675496

#TimeUsernameProblemLanguageResultExecution timeMemory
675496QwertyPiCATS (NOI14_cats)C++14
0 / 25
1594 ms262144 KiB
#include <bits/stdc++.h> using namespace std; vector<int> S1, S2; void out(){ cout << "*****************" << endl; cout << "S1: "; for(auto i : S1) cout << i << ' '; cout << endl; cout << "S2: "; for(auto i : S2) cout << i << ' '; cout << endl; } int solve(int X, int L, int N){ int COUNTER = X; S1.clear(); S2.clear(); for(int i = 0; i < X; i++) S1.push_back(0); for(int i = 0; i < X; i++) S2.push_back(0); while(COUNTER){ S2.push_back(S1.back()); S1.pop_back(); for(auto& i : S1) i ^= 1; if(S2.back() > L){ COUNTER--; if(COUNTER == 0) return S2.back(); }else{ S2.back() += N * 2; S1.push_back(S2.back()); S1.push_back(S2.back()); S2.pop_back(); S2.pop_back(); } } } int main(){ int q; cin >> q; for(int i = 0; i < q; i++){ int x, l, n; cin >> x >> l >> n; cout << solve(x, l, n) << endl; } }

Compilation message (stderr)

cats.cpp: In function 'int solve(int, int, int)':
cats.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...