Submission #202073

# Submission time Handle Problem Language Result Execution time Memory
202073 2020-02-13T13:32:44 Z darkkcyan CATS (NOI14_cats) C++14
0 / 25
466 ms 2180 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();
            --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() {
    // simulate(100, 5, 2); 
    int ntest; cin >> ntest; 
    while (ntest--) { 
        long long x, l, n; cin >> x >> l >> n; 
        --x; 
        x %= 8; 
        long long mul = l / n; 
        mul += 1 + (~mul & 1); 
        mul *= n; 
        cout << mul + (__builtin_popcountll(x) & 1) << '\n'; 
    } 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 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 8 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 466 ms 2180 KB Output isn't correct
2 Halted 0 ms 0 KB -