Submission #202074

# Submission time Handle Problem Language Result Execution time Memory
202074 2020-02-13T13:44:34 Z darkkcyan CATS (NOI14_cats) C++14
0 / 25
462 ms 2172 KB
#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 time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 462 ms 2172 KB Output isn't correct
2 Halted 0 ms 0 KB -