Submission #1029398

# Submission time Handle Problem Language Result Execution time Memory
1029398 2024-07-20T20:09:10 Z aguss CATS (NOI14_cats) C++17
0 / 25
1500 ms 3924 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 solve(){
    ll x, n, l;
    cin >> x >> l >> n;
    deque<ll> s1, s2;
    ll c = x;
    while(c){
        s2.push_front(!s1.size() ? 0 : s1.front());
        if(s1.size()) s1.pop_front();
        f1(i, s1){
            if(i % 2) i--;
            else i++;
        }
        ll y = (!s2.size() ? 0 : s2.front());
        if(y > l){
            c--;
            if(!c) cout << (!s2.size() ? 0 : s2.front()) << endl;
        } else {
            ll x = 2 * n + (!s2.size() ? 0 : s2.front());
            if(s2.size()) s2.pop_front();
            if(s2.size()) s2.pop_front();
            s1.push_front(x);
            s1.push_front(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 Incorrect 10 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 421 ms 3924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1584 ms 3480 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1552 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1533 ms 900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1560 ms 948 KB Time limit exceeded
2 Halted 0 ms 0 KB -