|
|
вернуться в форумMy program always gets WA at 0.04 sec. Does anybody have an idea why? (Source inside) Послано zdv 30 май 2002 17:01 #include <iostream.h> int c[5000]; int n,k,min=0; char s[500]; void main() { for(int i=0;i<5000;c[i]=0,i++); cin>>n; for(i=0;i<n;i++) { cin>>s; cin>>k; if(k) { cin>>c[i]; if(!min || min>c[i]) min=c[i]; else if(min<c[i]) { cout<<"NO"; return; } if(i>0) { k=i-1; while(!c[k]) c[k--]=c[i]; } } } k=0; for(i=0;i<n;i++) { if(c[i]) k+=c[i]; else k++; if(k>10000) { cout<<"NO"; return; } } cout<<"YES"; } |
|
|