# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7842 |
2014-08-19T11:27:28 Z |
qja0950 |
CATS (NOI14_cats) |
C++ |
|
1500 ms |
1096 KB |
#include <stdio.h>
#define MAXN 1001
int S1[MAXN], S2[MAXN], S1p, S2p;
int X, L, N;
int main() {
int Q;
scanf("%d", &Q);
for(int i=0; i<Q; i++) {
scanf("%d %d %d", &X, &L, &N);
int cnt = X;
while(cnt>0) {
S2[++S2p] = S1[S1p];
S1p--;
if(S1p<0) S1p=0;
for(int i=1; i<=S1p; i++) {
if(S1[i]%2==0) S1[i]++;
else S1[i]--;
}
// printf("[1] ");for(int i=1; i<=S1p; i++) printf("[%2d] ", S1[i]); printf("\n");
// printf("[2] ");for(int i=1; i<=S2p; i++) printf("[%2d] ", S2[i]); printf("\n");printf("\n");
if(S2[S2p] > L) {
cnt--;
if(cnt==0) {
printf("%d\n", S2[S2p]);
break;
}
// printf("\n-------[%d]--------\n", cnt);
}else{
S2[0] = S2[S2p]; S2p=0;
S2[S2p] += 2*N;
S1[++S1p] = S2[S2p];
S1[++S1p] = S2[S2p];
S2p--;S2p--;
if(S2p<0) S2p=0;
}
// printf("[1] ");for(int i=1; i<=S1p; i++) printf("[%2d] ", S1[i]); printf("\n");
// printf("[2] ");for(int i=1; i<=S2p; i++) printf("[%2d] ", S2[i]); printf("\n");printf("\n");
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
1096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
476 ms |
1096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1500 ms |
1096 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
1092 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
1092 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1092 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |