Submission #698127

#TimeUsernameProblemLanguageResultExecution timeMemory
698127europiumPoi (IOI09_poi)C++17
100 / 100
206 ms16076 KiB
// accepted - 12/2/23 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> #include <cmath> #include <iterator> #include <set> #include <map> #include <math.h> #include <iomanip> #include <unordered_set> #include <queue> #include <climits> using namespace std; // clang++ -std=c++17 IOI09_POI.cpp && ./a.out using ll = long long; void solve(){ int n, t, p; cin >> n >> t >> p; vector<int> score(t); vector<vector<int>> c (n, vector<int>(t)); for (int i = 0; i < n; i++){ for (int j = 0; j < t; j++){ cin >> c[i][j]; if (c[i][j] == 0) score[j]++; } } vector<tuple<int,int,int>> rank; // score, tasks solved, ID; for (int i = 0; i < n; i++){ int s = 0, solved = 0; // s is score for (int j = 0; j < t; j++){ if (c[i][j] == 1){ s += score[j]; solved++; } } // to account for sorting ID in increasing order (not decreasing order like score or solved) rank.push_back({s, solved, n - (i + 1)}); } sort(rank.rbegin(), rank.rend()); int cnt = 0; for (auto [s, solved, id] : rank){ cnt++; if (id == (n - p)){ cout << s << ' ' << cnt << '\n'; return; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("input.txt", "r", stdin); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...