Submission #1078387

#TimeUsernameProblemLanguageResultExecution timeMemory
1078387sqrteipiPoi (IOI09_poi)C++14
100 / 100
370 ms23888 KiB
#include <bits/stdc++.h> using namespace std; int cnt[2000]; bool cmp(pair<int, pair<int, int>> p1, pair<int, pair<int, int>> p2) { if (p1.first==p2.first&&p1.second.first==p2.second.first) return p1.second.second < p2.second.second; else if (p1.first==p2.first) return p1.second.first > p2.second.first; return p1.first > p2.first; } int main() { int n, t, p; cin >> n >> t >> p; int arr[n][t]; for (int i=0; i<t; i++) cnt[i] = n; for (int i=0; i<n; i++) for (int j=0; j<t; j++) cin >> arr[i][j], cnt[j] -= arr[i][j]; vector<pair<int, pair<int, int>>> vec; for (int i=0; i<n; i++) { int score = 0, ac_count = 0; for (int j=0; j<t; j++) score += cnt[j] * arr[i][j], ac_count += arr[i][j]; vec.push_back({score, {ac_count, i+1}}); } sort(vec.begin(), vec.end(), cmp); for (int i=0; i<n; i++) { if (vec[i].second.second==p) { cout << vec[i].first << " " << i+1 << "\n"; return 0; } // cout << vec[i].first << " " << vec[i].second.first << " " << vec[i].second.second << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...