Submission #290823

# Submission time Handle Problem Language Result Execution time Memory
290823 2020-09-04T13:25:50 Z gs14004 CATS (NOI14_cats) C++17
25 / 25
106 ms 8004 KB
#include <cstdio>
#include <cstring>
using lint = long long;

int main(){
	int q;
	scanf("%d",&q);
	while (q--) {
		lint x, l, n;
		scanf("%lld %lld %lld",&x,&l,&n);
		x--;
		lint Q = l / (2 * n) + 2;
		if(Q <= 61) x %= (1ll << Q);
		printf("%lld\n", (Q - 1) * (2 * n) +__builtin_popcountll(x) % 2);
	}
}

Compilation message

cats.cpp: In function 'int main()':
cats.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |  scanf("%d",&q);
      |  ~~~~~^~~~~~~~~
cats.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |   scanf("%lld %lld %lld",&x,&l,&n);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 87 ms 2172 KB Output is correct
2 Correct 106 ms 8004 KB Output is correct