Submission #322030

# Submission time Handle Problem Language Result Execution time Memory
322030 2020-11-13T23:44:00 Z super_j6 CATS (NOI14_cats) C++14
20 / 25
59 ms 6252 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

ll n, m, k;

void answer(){
	cin >> n >> m >> k;
	n--, k *= 2, m = m / k + 1;
	
	ll ret =  k * m++;
	ret |= __builtin_popcount(m <= __lg(n) ? n & ((1 << m) - 1) : n) & 1;
	
	cout << ret << endl;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	cin >> t;
	
	for(int i = 0; i < t; i++) answer();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 620 KB Output is correct
2 Correct 5 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 6252 KB Output isn't correct
2 Halted 0 ms 0 KB -