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

Why my code doesn't work?Sequence is wrong,but only'16 3'and'20 3'. Even the '22 4' and '26 4' are right.
Posted by jingyi Ma 13 Jan 2020 13:03
#include <iostream>
using namespace std;
int main()
{
    int n,a[100],b[100],c,d,i,j;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(i=0;i<n;i++)
        for(j=i+1;j<n;j++)
            if(b[i]<b[j])
            {
                c=b[i];
                b[i]=b[j];
                b[j]=c;
                d=a[i];
                a[i]=a[j];
                a[j]=d;
            }
    for(i=0;i<n;i++)
        cout<<a[i]<<' '<<b[i]<<'\n';
    return 0;
}


Help me! I'm die.
Sorrry,my English is poor.
I will try my best to understand you.