|
|
back to boardwhy TLE test 7? (c++) #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++) Because 64 * 10 ^ 9 is too many operations for 0.5 seconds :) |
|
|