Untitled
unknown
c_cpp
3 years ago
975 B
5
Indexable
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false) , cin.tie(0) ,cout.tie(0)
#define ll long long
using namespace std;
const int maxn = 1e6+7;
int b[maxn];
ll c[maxn];
void dbg(){
cerr << endl;
}
template<typename H, typename... T> void dbg(H h, T... t){
cerr << h << ", ";
dbg(t...);
}
#define er(...) cerr << __LINE__ << " <" << #__VA_ARGS__ << ">: ", dbg(__VA_ARGS__)
int main(){
ios;
int a ,j = 0;
// ll c ;
vector<ll> q;
cin >> a;
for(int i = 0 ; i < a ; i++){
cin >> b[i];
if(b[i] == 1)
cin >> c[i];
}
for(int i = 0 ; i < a ; i++){
if(b[i] == 1){
if(j >= q.size()) j = q.size();
q.push_back(c[i]);
}
if(b[i] == 2){
j++;
}
else if(b[i] == 3){
if( j >= q.size()) cout << "empty!\n";
else cout << q[j] << '\n' ;
}
// er(j);
}
return 0;
}Editor is loading...