제출 #231695

#제출 시각아이디문제언어결과실행 시간메모리
231695AlexLuchianovPoi (IOI09_poi)C++14
100 / 100
260 ms23800 KiB
#include <iostream> #include <vector> #include <algorithm> #include <vector> using namespace std; using ll = long long; #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) < (b)) ? (b) : (a)) int const nmax = 2000; int v[1 + nmax][1 + nmax]; int score[1 + nmax]; struct Person{ int id; int score; int problems; bool operator < (Person const &a) const { if(score != a.score) return score > a.score; else if(problems != a.problems) return problems > a.problems; else return id < a.id; } } lst[1 + nmax]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k, p; cin >> n >> k >> p; for(int i = 1; i <= k; i++) score[i] = n; for(int i = 1; i <= n; i++) for(int j = 1;j <= k; j++) { cin >> v[i][j]; score[j] -= v[i][j]; } for(int i = 1;i <= n; i++){ lst[i] = {i, 0, 0}; for(int j = 1;j <= k; j++) { lst[i].problems += v[i][j]; lst[i].score += score[j] * v[i][j]; } } sort(lst + 1, lst + n + 1); for(int i = 1;i <= n; i++) if(lst[i].id == p){ cout << lst[i].score << " " << i << '\n'; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...