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 2?
Posted by Anam 13 Feb 2014 17:05
wrong answer, but I do't know why! help, please

#include<iostream>
using std::cout;
using std::cin;
using std:: endl;
int main(){
    int res = 0;
    int n1, n2, n3;
    cin >> n1;
    unsigned *arr1 = new unsigned[n1];


    unsigned temp[100];
    for(int i = 0; i < n1; ++i){
        cin >> arr1[i];
    }
    cin >> n2;
    unsigned *arr2 = new unsigned[n2];
    for(int i = 0; i < n2; ++i){
        cin >> arr2[i];
    }
    cin >> n3;
    unsigned *arr3 = new unsigned[n3];
    for(int i = 0; i < n3; ++i){
        cin >> arr3[i];
    }
    int sum = 0;
    for(int i = 0; i < n1; i++){
        for(int j = 0; j < n2; ++j){
            if(arr2[j] == arr1[i])
            temp[i]= arr2[j];
            sum++;
        }
    }
    int sum1 = 0;
    for(int i = 0; i < sum; i++){
        for(int j = 0; j < n3; ++j){
            if(arr3[j] == temp[i])
            sum1++;
        }
    }
cout << sum1 << endl;
    delete[]arr1;
    delete[]arr2;
    delete[]arr3;
system("PAUSE");
return 0;
}