# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597506 | kabika | Poi (IOI09_poi) | C++14 | 220 ms | 16388 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;
typedef long long ll;
bool comp(tuple<int,int,int> p, tuple<int,int,int> q)
{
if(get<0>(p) != get<0>(q))
return get<0>(p) > get<0>(q);
if(get<1>(p) != get<1>(q))
return get<1>(p) > get<1>(q);
if(get<2>(p) != get<2>(q))
return get<2>(p) < get<2>(q);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, t, p;
cin >> n >> t >> p;
--p;
vector<vector<int>> slv(n,vector<int>(t,0));
vector<int> mrk(t);
for(int i = 0; i < n; ++i)
{
for(int j = 0; j < t; ++j)
{
cin >> slv[i][j];
if(!slv[i][j])
++mrk[j];
}
}
vector<tuple<int,int,int>> rnk(n,make_tuple(0,0,0));
int i = 0;
for(tuple<int,int,int> &tp : rnk)
{
get<2>(tp) = i;
for(int j = 0; j < t; ++j)
{
if(slv[i][j])
{
get<0>(tp) += mrk[j];
get<1>(tp) += 1;
}
}
++i;
}
sort(rnk.begin(),rnk.end(),comp);
/*for(auto &tp : rnk)
{
cout << get<0>(tp) << " "
<< get<1>(tp) << " "
<< get<2>(tp) << '\n';
}*/
for(int i = 0; i < n; ++i)
{
if(get<2>(rnk[i]) == p)
{
cout << get<0>(rnk[i]) << " " << i+1 << '\n';
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |