|
|
back to boardWA in test 4 Posted by Carbon 9 Apr 2007 19:39 My code must pass in all tests but it falls in 4 #include <iostream.h> int main() { bool array[65536]; for (int i=0;i<65536;i++) array[i]=false; int num; int N1,N2; cin>>N1; for (int i=0;i<N1;i++) { cin>>num; array[num+32768]=true; } cin>>N2; bool found=false; for (int i=0;i<N2;i++) { cin>>num; if (!found) found=array[42768-num]; } cout<<((found)?("YES"):("NO")); return 0; } Re: WA in test 4 ........ bool array[165536]; //here zero by default int main() { //for (int i=0;i<65536;i++) //array[i]=false; ...... 42768+32768>65536 Re: WA in test 4 do not declare array as local variables. it can be cause of stack oferflow (crash) |
|
|