Submission #696553

#TimeUsernameProblemLanguageResultExecution timeMemory
696553Hacv16Poi (IOI09_poi)C++17
100 / 100
221 ms57280 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 2e6 + 15; const int INF = 0x3f3f3f3f; int n, t, p, value[MAX], score[MAX]; vector<int> solve[MAX]; bool cmp(int a, int b){ if(score[a] != score[b]) return score[a] > score[b]; if(solve[a].size() != solve[b].size()) return solve[a].size() > solve[b].size(); return a < b; } int32_t main(void){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> t >> p; for(int i = 1; i <= t; i++) value[i] = n; for(int i = 1; i <= n; i++){ for(int k = 1; k <= t; k++){ ll x; cin >> x; if(x){ value[k]--; solve[i].push_back(k); } } } for(int i = 1; i <= n; i++) for(auto x : solve[i]) score[i] += value[x]; vector<int> rank(n); iota(rank.begin(), rank.end(), 1); sort(rank.begin(), rank.end(), cmp); for(int i = 0; i < rank.size(); i++) if(rank[i] == p){ cout << score[p] << ' ' << i + 1 << '\n'; exit(0); } }

Compilation message (stderr)

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