| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1148966 | blackslex | Poi (IOI09_poi) | C++20 | 232 ms | 16152 KiB |
#include<bits/stdc++.h>
using namespace std;
using tp = tuple<int, int, int>;
int n, m, p;
int main() {
scanf("%d %d %d", &n, &m, &p); p--;
vector<vector<int>> a(n, vector<int>(m));
vector<int> cnt(m, n);
for (auto &e: a) {
for (auto &E: e) scanf("%d", &E);
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) cnt[i] -= a[j][i];
}
vector<int> b(n), cnt2(n);
vector<tp> c;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) b[i] += cnt[j] * a[i][j], cnt2[i] += a[i][j];
c.emplace_back(b[i], cnt2[i], i);
}
sort(c.begin(), c.end(), [&] (const tp &p1, const tp &p2) {
auto [x1, y1, z1] = p1;
auto [x2, y2, z2] = p2;
return (x1 == x2 ? (y1 == y2 ? z1 < z2 : y1 > y2) : x1 > x2);
});
int ans = -1;
for (int i = 0; i < n; i++) {
if (get<2>(c[i]) == p) ans = i;
}
printf("%d %d", get<0>(c[ans]), ++ans);
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
