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 1100. Final Standings

Time Limit Exceeded WA11
Posted by garra 27 Mar 2013 18:02
#include<stdio.h>
#include<stdlib.h>


int main()
{
long unsigned int a[15000][2],i,j,n,temp,b,c;
scanf("%ld",&n);

for(i=0;i<n;i++)
{
scanf("%lu%lu",&b,&c);
if(b<=10000000&&c<=100)
{
a[i][0]=b;
a[i][1]=c;
}
else
{
return 0;
}
}


for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(a[j][1]<a[j+1][1])
{
temp=a[j][0];
a[j][0]=a[j+1][0];
a[j+1][0]=temp;

temp=a[j][1];
a[j][1]=a[j+1][1];
a[j+1][1]=temp;
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}

return 0;
}

Edited by author 27.03.2013 18:08