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 test 5 acces violation?
Posted by LiSu 4 Oct 2012 21:51
here is my code

#include<stdio.h>

int main()
{

    int n,k,i,m,l,p=0,a[100001];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    scanf("%d",&k); a[k]++;
    }

    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
    scanf("%d",&k); a[k]++;
    }

    scanf("%d",&l);
    for(i=0;i<l;i++)
    {
    scanf("%d",&k); a[k]++;
    if(a[k]==3){p++;}
    }


    printf("%d",p);


    return 0;}
Re: why test 5 acces violation?
Posted by Mazykach 5 Oct 2012 15:07
Try a[1000000000+1], because k<=10^9.
But in this case you have not enuf memory, so try another method.

Edited by author 05.10.2012 15:20