ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1196. History Exam

I can't understand,that why WA on test 1!!!????
Posted by ilya_romanenko 15 May 2011 23:54
It's my solution:

#include<iostream>
#include<stdio.h>
#include<time.h>
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    time_t start,end;
    start=clock();
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int a,b,c,d=0,i,j;
    int *m,*m1;
    m=new int [100000000];
    m1=new int [100000000];
    cin>>a;
    for(i=0;i<a;i++)
        cin>>m[i];
    cin>>b;
    for(i=0;i<b;i++)
        cin>>m1[i];
    for(i=0;i<a;i++)
    {
        c=m[i];
        for(j=0;j<b;j++)
            if(m[i]==m[j]){
                m[j]=0;
                d++;
            }
    }
    cout<<d;
    delete [] m;
    delete [] m1;
    return 0;
}
Это решение даёт правильный ответ,но не проходит... Почему????
Re: I can't understand,that why WA on test 1!!!????
Posted by Noob 16 May 2011 11:18
I can't understand it too.
It should be MLE: m=new int [100000000];
or TLE: for(i=0;i<a;i++) ... for(j=0;j<b;j++)
Re: I can't understand,that why WA on test 1!!!????
Posted by Daniyar 15 Jun 2011 21:24
maybe you shouldn't use freopen...