# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
290815 | gs14004 | CATS (NOI14_cats) | C++17 | 1584 ms | 40056 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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--;
if(l / (2 * n + 1) <= 61){
lint Q = l / (2 * n) + 1;
x %= (1ll << (Q + 1));
}
int s2 = 0;
s1.sz = 0;
int g = 0;
while (x>=0) {
s2 = s1.top() ^ g;
s1.pop();
g ^= 1;
if(s2 > l){
x--;
// printf("%d,", s2);
if(x < 0){
printf("%d\n",s2);
break;
}
}
else{
s2 += 2*n;
s1.push(s2^g);
s1.push(s2^g);
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |