|
|
back to boardwhy 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? 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 |
|
|