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

What is the test 32
Posted by Berol 31 Jul 2014 13:56
Please help me!  Got the WA#32 with the next code.

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
 int a,b,c,i,j,x=0, f=0, count=0;

 cin>>a;  long long int mass[a];
  for(i=0;i<a;i++) cin>>mass[i];
 cin>>b; long long int mass1[b];
   for(i=0;i<b;i++) cin>>mass1[i];
  cin>>c; long long int mass2[c];
 for(i=0;i<c;i++) cin>>mass2[i];

  int y = min(min(a,b), min(b,c));

 long long int mass3[y];
 for(int u=0; u<y; u++) mass3[u]=-1;

long long int mass4[y];
 for(int u=0; u<y; u++) mass4[u]=-1;

 for(i=0;i<a;i++)
 {
      for(j=0;j<b;j++)
      {
        if(mass[i]==mass1[j])
        {
        mass3[x]=mass[i];
        x++;
        }
    }
}

for(i=0;i<c;i++)
 {
      for(j=0;j<c;j++)
      {
        if(mass1[i]==mass2[j])
        {
        mass4[f]=mass1[i];
        f++;
        }
    }
}

for(i=0;i<y;i++)
{
    for(j=0;j<y;j++)
    {
        if(mass3[i]==mass4[j]&& mass3[i]!=-1 &&mass4[j]!=-1)
        count++;
    }
}

 cout<<count;
 return 0;

}