Submission #202074

#TimeUsernameProblemLanguageResultExecution timeMemory
202074darkkcyanCATS (NOI14_cats)C++14
0 / 25
462 ms2172 KiB
#include<bits/stdc++.h> using namespace std; void simulate(long long x, long long l, long long n) { vector<long long> s1, s2; bool s1_inv = 0; while (x) { if (!s1.size()) s1.push_back(0); if (!s2.size()) s2.push_back(0); s2.push_back(s1.back() ^ s1_inv); s1.pop_back(); s1_inv ^= 1; if (s2.back() > l) { cout << s2.back() << '\n'; --x; } else { s2.back() += 2ll * n; s1.push_back(s2.back() ^ s1_inv); s1.push_back(s2.back() ^ s1_inv); s2.pop_back(); if (s2.size()) s2.pop_back(); } } } int main() { int ntest; cin >> ntest; while (ntest--) { long long x, l, n; cin >> x >> l >> n; --x; x %= 8; if (l < 2 * n) x %= 4; long long mul = l / n; mul += 1 + (~mul & 1); mul *= n; cout << mul + (__builtin_popcountll(x) & 1) << '\n'; } // cout << endl; // simulate(100, 3, 2); return 0; }
#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...