Submission #7845

#TimeUsernameProblemLanguageResultExecution timeMemory
7845qja0950CATS (NOI14_cats)C++98
0 / 25
1500 ms79288 KiB
#include <stdio.h> #define MAXN 10010001 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 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...