Submission #967391

#TimeUsernameProblemLanguageResultExecution timeMemory
967391IsamMed (COCI22_med)C++17
50 / 50
34 ms504 KiB
#include<bits/stdc++.h> using namespace std; int n; int sm[501]; string s[501]; vector<pair<int, string>> em; pair<int, int> get(int i){ em.clear(); pair<int, int> res; for(register int j = 1; j <= n; ++j){ em.emplace_back(pair<int, string>{sm[j] + (i!=j?-500:0), s[j]}); } sort(em.begin(), em.end()); res.first = distance(em.begin(), find(em.begin(), em.end(), pair<int, string>{sm[i], s[i]})) + 1; em.clear(); for(register int j = 1; j <= n; ++j){ em.emplace_back(pair<int, string>{sm[j] + (i==j?-500:0), s[j]}); } sort(em.begin(), em.end()); res.second = distance(em.begin(), find(em.begin(), em.end(), pair<int, string>{sm[i] - 500, s[i]})) + 1; return res; } signed main(){ cin >> n; for(register int i = 1; i <= n; ++i){ cin >> s[i]; for(register int j = 1, a; j <= 5; ++j){ cin >> a; sm[i] += a; } sm[i] *= -1; } for(register int i = 1; i <= n; ++i){ pair<int, int> ou = get(i); cout << ou.second << ' ' << ou.first << '\n'; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'std::pair<int, int> get(int)':
Main.cpp:17:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |  for(register int j = 1; j <= n; ++j){
      |                   ^
Main.cpp:28:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 |  for(register int j = 1; j <= n; ++j){
      |                   ^
Main.cpp: In function 'int main()':
Main.cpp:43:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   43 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:45:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   45 |   for(register int j = 1, a; j <= 5; ++j){
      |                    ^
Main.cpp:45:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   45 |   for(register int j = 1, a; j <= 5; ++j){
      |                           ^
Main.cpp:52:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   52 |  for(register int i = 1; i <= n; ++i){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...