- #include <bits/stdc++.h>
- using namespace std;
- #define MAXN 200005
- vector<int>v;
- void show(){
- printf("whole array\n");
- for(int i = 0; i <v.size(); i++) cout<<v[i]<<" ";
- cout<<endl;
- }
- int main()
- {
- int ts;
- scanf("%d", &ts);
- for(int p = 1; p <=ts; p++){
- printf("Case %d:\n", p);
- v.clear();
- int a, n, q;
- scanf("%d%d", &n, &q);
- for(int i = 0; i <n; i++) scanf("%d", &a), v.push_back(a);
- for(int i = 0; i <q; i++){
- char ch;
- getchar();
- scanf("%c", &ch);
- if(ch == 'a') {
- int id;
- scanf("%d", &id);
- v.push_back(id);
- //show();
- }
- else {
- int id;
- scanf("%d", &id);
- if(id>v.size()) printf("none\n");
- else printf("%d\n", v[id-1]), v.erase(v.begin()+id-1);
- //show();
- }
- }
- }
- return 0;
- }
Wednesday, 26 July 2017
Lightoj 1087 (Vector version)
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment