Submission #201208

# Submission time Handle Problem Language Result Execution time Memory
201208 2020-02-09T19:31:29 Z MetB CATS (NOI14_cats) C++14
25 / 25
554 ms 8168 KB
#include <bits/stdc++.h>
 
#define N 1000001

using namespace std;
 
typedef long long ll;
 
const ll INF = 1e18, MOD = 1e9 + 7, MOD2 = 1e6 + 3;
 
int q;
 

 
int main () {
	cin >> q;

	for (int i = 0; i < q; i++) {
		ll x, l, n;
		cin >> x >> l >> n;

		x--;
		if (l / (2 * n) + 2 <= 62) x %= (1LL << (l / (2 * n) + 2));

		cout << 2 * n * (l / (2 * n) + 1) + __builtin_popcountll (x) % 2 << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 504 KB Output is correct
2 Correct 44 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 455 ms 2204 KB Output is correct
2 Correct 554 ms 8168 KB Output is correct