#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; } } } } /************************************************************** Problem: 1488 User: admin Language: C++ Result: Accepted Time:45 ms Memory:4420 kb ****************************************************************/