# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717745 | VMaksimoski008 | Poi (IOI09_poi) | C++14 | 188 ms | 332 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>
#define ll long long
#define pb push_back
using namespace std;
void setIO()
{
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
}
bool cmp(pair<int, int> a, pair<int, int> b)
{
if(a.second != b.second)
return (a.second < b.second);
else
return (a.first < b.first);
}
int main()
{
setIO();
int n, t, p, x;
int totalPoints = 0;
cin >> n >> t >> p;
vector<int> taskPoints(t+1, n);
vector<int> phillipSolved;
vector<pair<int, int> > rankList;
for(int i=0; i<n; i++)
{
for(int j=0; j<t; j++)
{
cin >> x;
if(x == 1)
taskPoints[j+1] -= 1;
if(i+1 == p)
{
if(x == 1)
phillipSolved.pb(j+1);
}
}
}
for(int h : phillipSolved)
totalPoints += taskPoints[h];
for(int i=1; i<=n; i++)
{
rankList.pb({i, 0});
for(int j=1; j<=t; j++)
{
rankList[rankList.size()-1].second += taskPoints[j];
}
}
sort(rankList.begin(), rankList.end(), cmp);
int phillipRank = 0;
for(auto a : rankList)
{
phillipRank++;
if(a.first == p)
break;
}
cout << totalPoints << " " << phillipRank << '\n';
return 0;
}
/*
5 3 2
0 0 1
1 1 0
1 0 0
1 1 0
1 1 0
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |