제출 #698125

#제출 시각아이디문제언어결과실행 시간메모리
698125europiumPoi (IOI09_poi)C++17
100 / 100
214 ms16224 KiB
// - 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; for (int j = 0; j < t; j++){ if (c[i][j] == 1){ s += score[j]; solved++; } } rank.push_back({s, solved, n - (i + 1)}); // cout << s << ' ' << solved << ' ' << i + 1 << '\n'; } sort(rank.rbegin(), rank.rend()); int cnt = 0; for (auto [s, solved, id] : rank){ cnt++; // cout << s << ' ' << solved << ' ' << id << '\n'; 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...