UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188318#3362. 签到题stonesx100634ms1256kbC++11501b2023-10-03 08:40:062023-10-03 12:03:43

answer

#include <bits/stdc++.h>
using namespace std;
queue<int> q;
char s[6];
int n, x;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif
	scanf("%d\n", &n);
	while (n--)
	{
		scanf("%s", s);
		if (s[2] == 'P')
			if (q.size())
				q.pop();
			else
				puts("ERROR!");
		else if (s[2] == 'S')
			scanf("%d", &x), q.push(x);
		else if (q.size())
			printf("%d\n", q.front());
		else
			puts("ERROR!");
	}
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 132ms
memory: 1256kb

input:

1000000
POP
QUERY
PUSH 309365360
POP
PUSH 199989283
QUERY
QUERY
PUSH 426129435
QUERY
QUERY
POP
POP
P...

output:

ERROR!
ERROR!
199989283
199989283
199989283
199989283
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
670617789
6...

result:

ok 333547 lines

Test #2:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

1000
PUSH 988230049
POP
QUERY
QUERY
PUSH 756384264
PUSH 475755011
PUSH 796369883
PUSH 570561132
PUSH...

output:

ERROR!
ERROR!
756384264
756384264
475755011
588509151
856803961
218518770
101998041
101998041
940337...

result:

ok 376 lines

Test #3:

score: 10
Accepted
time: 1ms
memory: 1232kb

input:

1000
POP
QUERY
PUSH 241930825
QUERY
POP
POP
PUSH 472761151
PUSH 877848433
QUERY
POP
POP
QUERY
PUSH 3...

output:

ERROR!
ERROR!
241930825
ERROR!
472761151
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
861469058
138600146
1386...

result:

ok 352 lines

Test #4:

score: 10
Accepted
time: 0ms
memory: 1232kb

input:

1000
QUERY
POP
QUERY
PUSH 249939428
PUSH 52380350
PUSH 465251810
PUSH 734617051
QUERY
PUSH 459553719...

output:

ERROR!
ERROR!
ERROR!
249939428
249939428
249939428
977811790
413512379
413512379
50593172
50593172
5...

result:

ok 350 lines

Test #5:

score: 10
Accepted
time: 0ms
memory: 1232kb

input:

1000
QUERY
QUERY
QUERY
QUERY
PUSH 849412139
POP
PUSH 368858122
POP
QUERY
POP
PUSH 370154366
PUSH 689...

output:

ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
689793445
122079564
ERROR!
ERROR!
ERROR!
849866440
8498664...

result:

ok 344 lines

Test #6:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

1000
QUERY
PUSH 382379904
POP
POP
QUERY
PUSH 307724811
QUERY
QUERY
POP
PUSH 814704179
QUERY
POP
POP
...

output:

ERROR!
ERROR!
ERROR!
307724811
307724811
814704179
ERROR!
ERROR!
ERROR!
908282704
908282704
63410573...

result:

ok 382 lines

Test #7:

score: 10
Accepted
time: 143ms
memory: 1252kb

input:

1000000
PUSH 248977493
PUSH 675561091
QUERY
QUERY
POP
QUERY
PUSH 101472384
POP
POP
QUERY
POP
PUSH 48...

output:

248977493
248977493
675561091
ERROR!
ERROR!
489211421
489211421
830805513
830805513
699334872
842492...

result:

ok 333541 lines

Test #8:

score: 10
Accepted
time: 117ms
memory: 1256kb

input:

1000000
PUSH 652152756
QUERY
POP
POP
QUERY
PUSH 794581491
QUERY
QUERY
PUSH 198565134
POP
PUSH 634933...

output:

652152756
ERROR!
ERROR!
794581491
794581491
198565134
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERRO...

result:

ok 333475 lines

Test #9:

score: 10
Accepted
time: 117ms
memory: 1252kb

input:

1000000
POP
QUERY
PUSH 459285888
QUERY
PUSH 316620231
PUSH 806052043
POP
POP
POP
PUSH 225673213
POP
...

output:

ERROR!
ERROR!
459285888
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
ERROR!
180302100
ERR...

result:

ok 333781 lines

Test #10:

score: 10
Accepted
time: 124ms
memory: 1252kb

input:

1000000
POP
PUSH 577769465
PUSH 228236795
QUERY
PUSH 367637907
QUERY
QUERY
PUSH 926762347
QUERY
QUER...

output:

ERROR!
577769465
577769465
577769465
577769465
577769465
577769465
577769465
367637907
367637907
367...

result:

ok 335167 lines

Extra Test:

score: 0
Extra Test Passed