|
|
вернуться в форумi think test case is wrong this problem it tell that N<150000 but why this program is wrong #include <stdio.h> #define MAX 150000 int main() { long num[MAX]={0}; unsigned char m[MAX]={0}; long n,i,j; scanf("%ld",&n); for(i=0;i<n;i++) { scanf("%ld %d",&num[i],&m[i]); } for(i=100;i>=0;i--) for(j=0;j<n;j++) if(m[j]==i) printf("%ld %ld\n",num[j],i); return 0; } but this program is right #include <stdio.h> #define MAX 150001 int main() { long num[MAX]={0}; unsigned char m[MAX]={0}; long n,i,j; scanf("%ld",&n); for(i=0;i<n;i++) { scanf("%ld %d",&num[i],&m[i]); } for(i=100;i>=0;i--) for(j=0;j<n;j++) if(m[j]==i) printf("%ld %ld\n",num[j],i); return 0; } Re: i think test case is wrong i think so! |
|
|