# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
634760 | PolishFighter | Poi (IOI09_poi) | C++17 | 211 ms | 9544 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;
constexpr int MAXN = 2e3 + 10;
int score[MAXN];
int task[MAXN];
vector<int> cont[MAXN];
bool check(int a, int b)
{
if(score[a] > score[b])
return true;
if(score[a] == score[b])
{
if(cont[a].size() > cont[b].size())
return true;
if(cont[a].size() == cont[b].size())
return a < b;
return false;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, t, p, tmp;
cin >> n >> t >> p;
p--;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < t; j++)
{
cin >> tmp;
if(tmp == 0)
task[j]++;
else
cont[i].push_back(j);
}
}
vector<int> cont_s;
for(int i = 0; i < n; i++)
{
for(size_t j = 0; j < cont[i].size(); j++)
{
score[i] += task[cont[i][j]];
}
cont_s.push_back(i);
}
sort(cont_s.begin(), cont_s.end(), check);
for(int i = 0; i < n; i++)
{
if(cont_s[i] == p)
{
cout << score[cont_s[i]] << " " << i+1 << "\n";
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |