Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(){
- int n;
- cin>>n;
- char x;
- int y;
- vector<int>v;
- for(int i=1;i<=n;i++){
- cin>>x;
- if(x=='P'){
- cin>>y;
- for(int j=0;j<n;j++){
- if(v[j]==y){
- v.insert(v.begin()+j,i);
- cout<<j+1<<endl;
- break;
- }
- }
- }else{
- v.push_back(i);
- cout<<v.size()<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment