Submission #858806

#TimeUsernameProblemLanguageResultExecution timeMemory
858806aykhnPoi (IOI09_poi)C++14
100 / 100
182 ms39764 KiB
#include <bits/stdc++.h> // author : aykhn using namespace std; typedef long long ll; #define pb push_back #define ins insert #define mpr make_pair #define all(v) v.begin(), v.end() #define bpc __builtin_popcount #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define int ll #define infll 0x3F3F3F3F3F3F3F3F #define inf 0x3F3F3F3F const int MXN = 2e3 + 5; int freq[MXN]; int mat[MXN][MXN]; void _() { int n, m, p; cin >> n >> m >> p; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> mat[i][j]; freq[j] += mat[i][j]; } } vector<pair<pii, int>> v; for (int i = 1; i <= n; i++) { int s = 0; int c = 0; for (int j = 1; j <= m; j++) { if (mat[i][j]) s += n - freq[j]; c += mat[i][j]; } v.pb(mpr(mpr(s, c), i)); } sort(all(v), [&](const pair<pii, int> &a, pair<pii, int> &b) { if (a.fi == b.fi) return a.se < b.se; return a.fi > b.fi; }); for (int i = 0; i < v.size(); i++) { if (v[i].se == p) { cout << v[i].fi.fi << " " << i + 1 << '\n'; return; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; for (int i = 1; i <= t; i++) { _(); } }

Compilation message (stderr)

poi.cpp: In function 'void _()':
poi.cpp:55:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for (int i = 0; i < v.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...