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

8 Time limit
Posted by daria 10 May 2013 02:07
Please, help me

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int M, N, t=0, d;
    cin>>N;
    vector<int> n(N);
    for(int i=0; i<N; i++)
    {
        cin>>n[i];
    }
    sort(n.begin(), n.end());
    n.erase(unique(n.begin(), n.end() ), n.end());
    cin>>M;
    for(int i=0; i<M; i++)
    {
        cin>>d;
        if((d>=n[0])and(d<=n[N-1]))
        {
            t+=count(n.begin(),n.end(),d);
        }
    }
    cout<<t;
    return(0);
}
Re: 8 Time limit
Posted by fotol 12 May 2013 02:28
var n,k,m,i,i1:longint;
w:array[1..1000000] of longint;
w1:array[1..100000] of longint;

begin
readln(n);
For i:=1 to n do readln(w[i]);
readln(m);
For i:=1 to m do readln(w1[i]);
For i:=1 to n do begin
    For i1:=1 to m do begin
                   if w[i]=w1[i1] Then begin
                                        k:=k+1; w1[i1]:=0;
                                        end;
end;
end;
Writeln(k);
end.


I have the WA too. HELLLP