# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732972 | Roman70 | Poi (IOI09_poi) | C++17 | 217 ms | 27068 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 forn(i,n) for(int i = 0;i<n;i++)
#define ll long long
#define pb push_back
#define sz(a) a.size()
using namespace std;
struct player{
int points = 0;
int p =0;
vector<int>t;
int id;
};
bool cmp(player a, player b){
if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
}
void solve()
{
int n,p,m;
cin >> n >> p >> m;
player pl[n];
int puncte[p];
memset(puncte,0,sizeof(puncte));
forn(i,n){
pl[i].id = i;
forn(j,p){
int t;
cin >> t;
if(t) {pl[i].t.push_back(j);}
else puncte[j]++;
}
}
forn(i,n){
pl[i].p = pl[i].t.size();
for(auto prob : pl[i].t)
pl[i].points += puncte[prob];
}
sort(pl,pl+n,cmp);
forn(i,n) {
if(pl[i].id == p){
cout<<pl[i].points<<" "<<i+1<<"\n";
break;
}
}
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// cout << 4;
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |