# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1029423 |
2024-07-20T20:38:44 Z |
aguss |
CATS (NOI14_cats) |
C++14 |
|
1500 ms |
4428 KB |
#include <bits/stdc++.h>
#define sp " "
#define endl "\n"
#define f1(i, x) for(auto &i : x)
#define f2(i, x, n) for(int i = n; i < x; i++)
typedef long long ll;
using namespace std;
void push(deque<ll> &s, ll a){
if(a < 0){
f1(i, s) i ^= 1;
} else s.push_front(a);
}
void solve(){
ll x, l, n;
cin >> x >> l >> n;
deque<ll> s1, s2;
ll c = x;
ll f = 0;
while(c){
push(s2, s1.empty() ? f : s1.front());
if(s1.size()) s1.pop_front();
f1(i, s1){
i ^= 1;
f ^= 1;
}
if(s2.front() > l){
c--;
if(!c) cout << s2.front() << endl;
} else {
ll x = 2 * n + s2.front();
s2.pop_front();
if(s2.size()) s2.pop_front();
push(s1, x);
push(s1, x);
}
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
604 KB |
Output is correct |
2 |
Correct |
15 ms |
3548 KB |
Output is correct |
3 |
Correct |
13 ms |
1624 KB |
Output is correct |
4 |
Correct |
14 ms |
1388 KB |
Output is correct |
5 |
Correct |
12 ms |
2808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
598 ms |
4188 KB |
Output is correct |
2 |
Correct |
448 ms |
4428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1559 ms |
3516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1505 ms |
556 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1555 ms |
848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1529 ms |
1040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |