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 1880. Psych Up's Eigenvalues

why TLE test 7? (c++)
Posted by ONPU_sonmc 3 Nov 2012 22:15
#include<iostream>
#include<vector>
#include <cmath>
using namespace std;

int main()
{
    int n1,n2,n3,x;
    int sch=0;
    vector<int>nv1;
    vector<int>nv2;
    vector<int>nv3;
    cin>>n1;
    for(int i=0; i<n1; i++)
    {
        cin>>x; nv1.push_back(x); x=0;
    }
    cin>>n2;
    for(int i=0; i<n2; i++)
    {
        cin>>x; nv2.push_back(x); x=0;
    }
    cin>>n3;
    for(int i=0; i<n3; i++)
    {
        cin>>x; nv3.push_back(x); x=0;
    }
    for(int i=0; i<n1; i++) {
        for(int j=0; j<n2; j++) {
            for(int k=0; k<n3; k++)
            {
                if((nv1[i]==nv2[j])&&(nv2[j]==nv3[k])) { sch=sch+1;}
            }
        }
    }
    cout<<sch<<endl;

}
Re: why TLE test 7? (c++)
Posted by Andrew Sboev [USU] 3 Nov 2012 23:16
Because 64 * 10 ^ 9 is too many operations for 0.5 seconds :)