답안 #290822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
290822 2020-09-04T13:25:06 Z gs14004 CATS (NOI14_cats) C++17
20 / 25
89 ms 6264 KB
#include <cstdio>
#include <cstring>
using lint = long long;

struct cat_stack{
	int stack[5000005], sz;
	int top(){
		if(sz == 0) return 0;
		return stack[sz-1];
	}
	void pop(){
		if(sz != 0) sz--;
	}
	void push(int x){
		stack[sz++] = x;
	}
}s1;

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);
		}
		int g = __builtin_popcount(x) % 2;
		printf("%lld\n", (Q - 1) * (2 * n) + g);
	}
}

Compilation message

cats.cpp: In function 'int main()':
cats.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  scanf("%d",&q);
      |  ~~~~~^~~~~~~~~
cats.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |   scanf("%lld %lld %lld",&x,&l,&n);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 640 KB Output is correct
2 Correct 8 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 89 ms 6264 KB Output isn't correct
2 Halted 0 ms 0 KB -