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

ilya_romanenko I can't understand,that why WA on test 1!!!???? [2] // Problem 1196. History Exam 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;
}
Это решение даёт правильный ответ,но не проходит... Почему????
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++)
maybe you shouldn't use freopen...