Submission #753770

#TimeUsernameProblemLanguageResultExecution timeMemory
753770vjudge1Poi (IOI09_poi)C++98
0 / 100
584 ms16848 KiB
#include <bits/stdc++.h> using namespace std; bool comparator(pair <int, int> a, pair <int, int> b){ if(a.first==b.first&&a.second<b.second) return true; return false; } int main(){ int n, t, p; cin >> n >> t >> p; int task[t+2]; vector <pair <int, int>> rank; for(int i=0; i<n; i++){ for (int j = 1; j <= t; ++j){ int x; cin >> x; if(x==0) task[j]++; if(x==1) rank.push_back(make_pair(j, i)); } } vector <pair <int, int>> final(n+2); for (int i = 0; i < rank.size(); ++i){ final[rank[i].second].first+=task[rank[i].first]; final[rank[i].second].second=rank[i].second; } sort(final.rbegin(), final.rend(), comparator); for (int i = 0; i < n; ++i){ if(final[i].second==p-1){ cout << final[i].first << " " << i+1 << endl; } } }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i = 0; i < rank.size(); ++i){
      |                  ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...