# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51359 | KieranHorgan | CATS (NOI14_cats) | C++17 | 1571 ms | 329852 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(10, 0), s2(10, 0);
int xo = 0, x;
while(counter) {
s2.clear();
if(s1.empty()) s1.push_back(0);
s2.push_back(s1.back() ^ xo);
s1.pop_back();
xo ^= 1;
if(s2.back() > L) {
counter--;
} else {
s2.back() = s2.back() + N*2;
s1.push_back(s2.back()^xo);
s1.push_back(s2.back()^xo);
}
}
cout << s2.back() << endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |