Created
December 12, 2013 16:26
-
-
Save taikoubou/7930801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<algorithm> | |
#include<vector> | |
int level[101],exp[101],num[101]; | |
using namespace std; | |
int main(){ | |
int N,M; | |
cin >> N >> M; | |
for(int i=1;i<=N;i++){ | |
level[i] = 1; | |
num[i] = i; | |
} | |
for(int i=0;i<M;i++){ | |
int tmp,tmp_2; | |
cin >> tmp; | |
cin >> tmp_2; | |
exp[tmp]+=tmp_2; | |
if(exp[tmp] >= 100*level[tmp]){ | |
level[tmp]++; | |
exp[tmp] = 0; | |
} | |
} | |
/*for(int i=1;i<=N;i++){ | |
while(exp[i] >= 100*level[i]){ | |
level[i]++; | |
exp[i] -= 100*level[i]; | |
*if(exp[i] < 0){ | |
level[i]--; | |
break; | |
}* | |
} | |
}*/ | |
for(int i=1;i<N;i++){ | |
for(int j=i+1;j<=N;j++){ | |
if(level[i] < level[j]){ | |
level[i] ^= level[j]; | |
level[j] ^= level[i]; | |
level[i] ^= level[j]; | |
num[i] ^= num[j]; | |
num[j] ^= num[i]; | |
num[i] ^= num[j]; | |
} | |
else if(level[i] == level[j] && num[i] > num[j]){ | |
level[i] ^= level[j]; | |
level[j] ^= level[i]; | |
level[i] ^= level[j]; | |
num[i] ^= num[j]; | |
num[j] ^= num[i]; | |
num[i] ^= num[j]; | |
} | |
} | |
} | |
// for(int i=1;i<=N;i++)cout << level[i] << endl; | |
for(int i=1;i<=N;i++)cout << num[i] << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment