1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; vector<int> a[100010];//向量数组,相当于二维数组 int main(){ int n,x,y,i; string order;//指令 cin>>n; for(i = 1;i <= n;i++){ cin>>order;//读入指令 if(order == "ADD"){ cin>>x>>y;//对第几个问题评论了 a[x].push_back(y); } else if(order == "QUERY"){ cin>>x>>y; if(a[x].size() < y){ cout<<"-1"<<endl; } else{ cout<<a[x][y-1]<<endl; } } } }
- 1
Information
- ID
- 10484
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By