# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493862 | ahmeteren | Poi (IOI09_poi) | C++17 | 238 ms | 23832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
// #endif
int n, k, p;
cin >> n >> k >> p;
vector<int> cnt(k);
vector<vector<int>> vec(n, vector<int> (k, 0));
vector<pair<pair<int, int>, int>> v;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < k; j++)
{
cin >> vec[i][j];
if(vec[i][j] == 0)
cnt[j]++;
}
}
for(int i = 0; i < n; i++)
{
int puan = 0, say = 0;
for(int j = 0; j < k; j++)
{
if(vec[i][j])
{
puan += cnt[j];
say++;
}
}
v.push_back({{puan, say}, -i});
}
sort(v.rbegin(), v.rend());
for(int i = 0; i < n; i++)
{
if(-v[i].second == p - 1)
{
cout << v[i].first.first << " " << i + 1 << '\n';
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |