Submission #51363

#TimeUsernameProblemLanguageResultExecution timeMemory
51363KieranHorganCATS (NOI14_cats)C++17
12 / 25
1567 ms263976 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define int long long #define ld long double #define pii pair<int,int> #define rand() abs((rand()<<15)|rand()) #define randll() abs(((long long)rand()<<30)|rand()) signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long seed; asm("rdtsc" : "=A"(seed)); srand(seed); int q; cin >> q; while(q--) { int X, L, N; cin >> X >> L >> N; int counter = X; vector<int> s1; int s2 = 0; int x = 0; while(counter) { if(s1.empty()) s1.push_back(0); s2 = s1.back()^x; x^=1; s1.pop_back(); if(s2 > L) { counter--; } else { s2 += N*2; s1.push_back(s2^x); s1.push_back(s2^x); } } cout << s2 << endl; } }
#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...