Submission #290822

#TimeUsernameProblemLanguageResultExecution timeMemory
290822gs14004CATS (NOI14_cats)C++17
20 / 25
89 ms6264 KiB
#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 (stderr)

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);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...