Submission #00003


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<algorithm>
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<vector>
#include<limits.h>
#include<string>
#include<cstdlib>
#include<queue>
#include<iterator>
#include<deque>
#include<set>
#include<unordered_set>
#include<map>
#include<stack>
#define mset multiset
#define unset unordered_set
#define ll long long
#define endl "\n";
#define prg_queue priority_queue <int,vector<int>,greater<int>
#define pr_queue priority_queue <int>
#define vector vector <int>
#define upper upper_bound
#define lower lower_bound
using namespace std;
int main(){
ll a,b=0,c=0,d=0,e=0;
deque <int> q;
cin >>a;
for (int o=0; o<a; o++){
cin >>b;
if(b==1){
cin >>c;
q.push_front(c);
}
if(b==2){
if(q.begin()!=q.end()){
q.pop_back();
}
}
if(b==3){
e=0;
for (auto i:q){
e++;
}
cout <<e<<endl;
}
if(b==4){
if(q.begin()!=q.end()){
cout <<q.back()<<endl
}else{
cout <<"-1"<<endl
}
}
}
return 0;
}

ステータス

項目 データ
問題 0002 - 行列のできる喫茶店
ユーザー名 SnakyZoo8277089
投稿日時 2024-07-08 16:32:53
言語 C++17
状態 Accepted
得点 15
ソースコード長 1240 Byte
最大実行時間 135 ms
最大メモリ使用量 1468 KB

セット

セット 得点 Cases
1 ALL 15 / 15 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 21 ms 604 KB
1
in2.txt AC 20 ms 572 KB
1
in3.txt AC 15 ms 416 KB
1
in4.txt AC 135 ms 896 KB
1
in5.txt AC 134 ms 1244 KB
1
in6.txt AC 134 ms 1468 KB
1