fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. //#define int long long
  4. #define INF (int)1e9+5
  5. #define ll long long
  6. #define MAX (int)1e9+5
  7. #define pb push_back
  8. #define mp make_pair
  9. #define fi first
  10. #define se second
  11. #define pii pair<int,string>
  12. #define endl "\n"
  13. #define all(A) A.begin(),A.end()
  14.  
  15. struct aux{
  16. int a;
  17. string b;
  18. };
  19.  
  20. bool cmp(aux c, aux d){
  21. if(c.a > d.a){
  22. return true;
  23. }else if(c.a == d. a){
  24. if(c.b < d.b){
  25. return true;
  26. }else{
  27. return false;
  28. }
  29. }else if(c.a < d.a){
  30. return false;
  31. }
  32. }
  33.  
  34. int32_t main(){
  35. int n, k, x;
  36. cin >> n >> k;
  37. string s;
  38. map<string,int> msg;
  39. map<string,int>nivel;
  40.  
  41. for(int i = 0; i<n; i++){
  42. cin >> s >> x;
  43. if(msg.count(s)){
  44. if(abs(x - msg[s]) >= k){
  45. nivel[s]+=25;
  46. msg[s] = x;
  47. }
  48. }else if(!msg.count(s)){
  49. msg.insert(mp(s,x));
  50. nivel.insert(mp(s,25));
  51.  
  52. }
  53. }
  54. vector<aux>v;
  55. for(auto u : nivel){
  56. aux y;
  57. y.a = u.se;
  58. y.b = u.fi;
  59. v.pb(y);
  60. }
  61.  
  62. sort(v.begin(),v.end(),cmp);
  63.  
  64. cout << "--Rank do Nepscord--\n";
  65.  
  66. if(v.size() == 1){
  67. cout << "#" << 1 << " " << v[0].b << " - Nivel " << ((v[0].a)/100)+1 << endl;
  68. cout << "#2.\n";
  69. cout << "#3.\n";
  70. }
  71. else if(v.size() == 2){
  72. cout << "#" << 1 << " " << v[0].b << " - Nivel " <<((v[0].a)/100)+1 << endl;
  73. cout << "#" << 2 << " " << v[1].b << " - Nivel " << ((v[1].a)/100)+1 << endl;
  74. cout << "#3.\n";
  75. }else if(v.size() >= 3){
  76. cout << "#" << 1 << " " << v[0].b << " - Nivel " << ((v[0].a)/100)+1 << endl;
  77. cout << "#" << 2 << " " << v[1].b << " - Nivel " << ((v[1].a)/100)+1 << endl;
  78. cout << "#" << 3 << " " << v[2].b << " - Nivel " << ((v[2].a)/100)+1 << endl;
  79. }else if(v.size() == 0){
  80. cout << "#1.\n";
  81. cout << "#2.\n";
  82. cout << "#3.\n";
  83. }
  84.  
  85. /*for(int i = 0; i<3; i++){
  86. //printf("#%d. %s - Nivel %d",i+1,v[i].second,v[i].first);
  87. cout << "#" << i+1 << " " << v[i].second << " - Nivel " << v[i].fi << endl;
  88.   }*/
  89. return 0;
  90. }
  91.  
Success #stdin #stdout 0s 4460KB
stdin
Standard input is empty
stdout
--Rank do Nepscord--
#1  - Nivel 1
#2.
#3.