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

Does not accept
Posted by mhsn 3 Nov 2012 14:10
this is my code in C++ but the system does not accept it. please help me.
---------------------------------------------------------------
#include<iostream>
using namespace std;
int main()
{
    long long int nums[100][100];
    char x[90];
    int n, m;
    long long int id, temp;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>id>>m;
        nums[i][0]=id;
        nums[i][1]=m;
    }
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            if(nums[j][1]>nums[i][1])
            {
                temp=nums[j][0];
                nums[j][0]=nums[i][0];
                nums[i][0]=temp;
                temp=nums[j][1];
                nums[j][1]=nums[i][1];
                nums[i][1]=temp;
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        cout<<nums[i][0]<<" "<<nums[i][1]<<endl;
    }
    return 0;
}

Edited by author 03.11.2012 14:25
Re: Does not accept
Posted by Nazarbek Altybay 5 Aug 2013 18:41
It will get TLE, because it works in N^2.
Re: Does not accept
Posted by r1d1 6 Aug 2013 02:40
use std::stable_sort...