Submission #1013032

# Submission time Handle Problem Language Result Execution time Memory
1013032 2024-07-03T05:58:35 Z vjudge1 ACM (COCI19_acm) C++17
50 / 50
5 ms 604 KB
#include<bits/stdc++.h>

using namespace std;

#define team "NijeZivotJedanACM"

map<string, pair<int,int> > points; 

bool sorter(pair<int,pair<int,string> > a, pair<int, pair<int, string> > b)
{
  if(a.first != b.first) return a.first > b.first;
  return a.second < b.second;
}


int main()
{
  int n, m;
  cin >> n >> m;
  for(int i = 0; i <= n; i ++)
    {
      string name;
      cin >> name;
      pair<int,int> score = {0, 0};
      for(int j = 0; j < m; j ++)
	{
	  string res;
	  cin >> res;
	  if(res[0] == '-') continue;
	  score.first++;
	  score.second += 20 * (res[1]  - '1') * 60;
	  score.second += stoi(res.substr(3, 2)) * 3600;
	  score.second += stoi(res.substr(6, 2)) * 60;
	  score.second += stoi(res.substr(9, 2));
	}
      points[name] = score;
    }

  vector<pair<int, pair<int, string> > > vec;
  for(auto x : points)
    vec.push_back({x.second.first, {x.second.second, x.first}});

  sort(vec.begin(), vec.end(), sorter);
  for(int i = 0; i < vec.size(); i ++)
    if(vec[i].second.second == team)
      cout << i + 1 << endl;
  
  return 0;
}

Compilation message

acm.cpp: In function 'int main()':
acm.cpp:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, std::__cxx11::basic_string<char> > > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   for(int i = 0; i < vec.size(); i ++)
      |                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 4 ms 472 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 5 ms 604 KB Output is correct
5 Correct 5 ms 604 KB Output is correct