| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么总是WA啊。#include <iostream>
using namespace std;
int main(){
int t,output[200000],l=0,c[20000],d[20000];
char cmd;
cin>>t;
while(t--){
int n;
cin>>n;
cin>>cmd;
memset(c,0,sizeof(c));
memset(d,0,sizeof(d));
while(cmd!='O'){
if(cmd=='E'){
int p;
cin>>p;
output[l++]=d[p];
}else{
int p,q;
cin>>p>>q;
d[p]=abs(p-q);
c[p]=q;
for(int i=0;i<n;i++){
if(c[i]==p){
c[i]=q;
d[i]+=d[p];
}
}
}
cin>>cmd;
}
}
for(int i=0;i<l;i++) cout<<output[i]<<endl;
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator