Submission #1148954

#TimeUsernameProblemLanguageResultExecution timeMemory
1148954blackslexPoi (IOI09_poi)C++20
20 / 100
215 ms16152 KiB
#include<bits/stdc++.h>

using namespace std;
using pii = pair<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);
    vector<pii> c;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) b[i] += cnt[j] * a[i][j];
        c.emplace_back(b[i], i);
    }
    sort(c.begin(), c.end(), [&] (const pii &p1, const pii &p2) {
        return (p1.first == p2.first ? p1.second < p2.second : p1.first > p2.first);
    });
    int ans = -1;
    for (int i = 0; i < n; i++) {
        if (c[i].second == p) ans = i;
    }
    printf("%d %d", c[ans].first, ++ans);
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d %d", &n, &m, &p); p--;
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:13:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         for (auto &E: e) scanf("%d", &E);
      |                          ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...