|
|
back to boardshows wrong answer! Posted by Ajinkya 24 Jun 2015 16:40 #include<iostream> int main() { using namespace std; unsigned long long n,id[10000],x; int m[100],y,i,j; cin>>n; for(i=0;i<n;i++) cin>>id[i]>>m[i]; for(i=0;i<n;i++) { for(j=i;j<n;j++) { if(m[i]<m[i+1]) { x=id[i]; id[i]=id[i+1]; id[i+1]=x; y=m[i]; m[i]=m[i+1]; m[i+1]=y; } } }
for(i=0;i<n;i++) cout<<id[i]<<" "<<m[i]<<"\n"; return 0; } |
|
|