Submission #597506

#TimeUsernameProblemLanguageResultExecution timeMemory
597506kabikaPoi (IOI09_poi)C++14
100 / 100
220 ms16388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool comp(tuple<int,int,int> p, tuple<int,int,int> q) { if(get<0>(p) != get<0>(q)) return get<0>(p) > get<0>(q); if(get<1>(p) != get<1>(q)) return get<1>(p) > get<1>(q); if(get<2>(p) != get<2>(q)) return get<2>(p) < get<2>(q); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, t, p; cin >> n >> t >> p; --p; vector<vector<int>> slv(n,vector<int>(t,0)); vector<int> mrk(t); for(int i = 0; i < n; ++i) { for(int j = 0; j < t; ++j) { cin >> slv[i][j]; if(!slv[i][j]) ++mrk[j]; } } vector<tuple<int,int,int>> rnk(n,make_tuple(0,0,0)); int i = 0; for(tuple<int,int,int> &tp : rnk) { get<2>(tp) = i; for(int j = 0; j < t; ++j) { if(slv[i][j]) { get<0>(tp) += mrk[j]; get<1>(tp) += 1; } } ++i; } sort(rnk.begin(),rnk.end(),comp); /*for(auto &tp : rnk) { cout << get<0>(tp) << " " << get<1>(tp) << " " << get<2>(tp) << '\n'; }*/ for(int i = 0; i < n; ++i) { if(get<2>(rnk[i]) == p) { cout << get<0>(rnk[i]) << " " << i+1 << '\n'; break; } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'bool comp(std::tuple<int, int, int>, std::tuple<int, int, int>)':
poi.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...