Submission #125451

# Submission time Handle Problem Language Result Execution time Memory
125451 2019-07-05T10:34:29 Z Touubs CATS (NOI14_cats) C++17
0 / 25
659 ms 7884 KB
        #include <bits/stdc++.h>
        using namespace std;
        #define dout if(false) cout
        #define int unsigned long long
         
        void testcase() {
            int X, L, N;
            cin >> X >> L >> N;
            int originalX = X;
            X--;
         
            int level = L/(2*N) + 1;
            dout << "level: " << level << endl;
         
            

            int flips = 0;
         
         
            while (X > 0 && level > 0) {
                //cout << "X: " << X << ", flips: " << flips << " | ";
                if ((X & 1) == 1) flips = flips ^ 1;
                X = X >> 1;
                level--;
            }
         
            dout << endl << "end. flips: " << flips << endl;
            int min = (L/(2*N) + 1) * (2*N);
            cout << ((min ^ ((flips) & 1))) << endl;
        }
         
        signed main() {
            int Q;
            cin >> Q;
            for (int i = 0; i < Q; i++) {
                testcase();
            }
            
        }

Compilation message

cats.cpp: In function 'void testcase()':
cats.cpp:9:17: warning: unused variable 'originalX' [-Wunused-variable]
             int originalX = X;
                 ^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Incorrect 6 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 760 KB Output is correct
2 Incorrect 51 ms 760 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 575 ms 6400 KB Output is correct
2 Incorrect 659 ms 7884 KB Output isn't correct