|
|
back to boardWA#1 Posted by frp 26 Feb 2010 21:27 I got WA#1. But my program gives correct result for all tests what i found on this forum. Why WA#1? Please give tests where my program will give incorrect result. My source code: //////////////////////////// ///Stupid brute force #include <iostream> #include <cstdio> using namespace std; int mem[30000]; //set<int> fb; int main() { char a[100]; char c; int ltd=0; int i; for(i=0;i<30000;i++)mem[i]=0; while(!cin.eof()) { cin.getline(a,100); int t,mp; sscanf(a,"%d %c%d",&t,&c,&mp); mp--; int mfb=40000; for(i=0;i<30000;i++) { mem[i]-=t-ltd; if((mem[i]<1)&&(i<mfb)){mfb=i;if(t==ltd)break;} } if(c=='+') { mem[mfb]=600; cout<<mfb+1<<'\n'; } else { if(mem[mp]>0){mem[mp]=600;cout<<"+\n";} else cout<<"-\n"; } ltd=t; } return 0; } |
|
|