# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
858806 |
2023-10-09T08:15:27 Z |
aykhn |
Poi (IOI09_poi) |
C++14 |
|
182 ms |
39764 KB |
#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
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 time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2576 KB |
Output is correct |
6 |
Correct |
1 ms |
2544 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
4700 KB |
Output is correct |
11 |
Correct |
6 ms |
6748 KB |
Output is correct |
12 |
Correct |
11 ms |
9052 KB |
Output is correct |
13 |
Correct |
29 ms |
14052 KB |
Output is correct |
14 |
Correct |
41 ms |
18512 KB |
Output is correct |
15 |
Correct |
70 ms |
23892 KB |
Output is correct |
16 |
Correct |
75 ms |
24316 KB |
Output is correct |
17 |
Correct |
111 ms |
29940 KB |
Output is correct |
18 |
Correct |
127 ms |
32676 KB |
Output is correct |
19 |
Correct |
177 ms |
38772 KB |
Output is correct |
20 |
Correct |
182 ms |
39764 KB |
Output is correct |