# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1063943 | kingjuno | Poi (IOI09_poi) | C++14 | 389 ms | 23564 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.
/*
* king_juno
* 2024-08-18 11:27:26
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef map<ll,ll> mapi;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define fl(i, b) for (int i=0; i<(b); i++)
#define fr(i, a, b) for (int i=0; i<(b); i++)
#define el "\n"
#define sp " "
#define pb push_back
#define spre(x) fixed<<setprecision(x)
#define read(s) fl(i,s.size())cin>>s[i];
#define write(s) fl(i,s.size())cout<<s[i]<<sp;
#define sor(s) sort(s.begin(),s.end());
#define rsor(s) sort(s.rbegin(),s.rend());
#define inf INT_MAX
#define rev(a) reverse(a.begin(),a.end());
#define sumv(a) accumulate(a.begin(),a.end());
#define maxv(a) max_element(a.begin(),a.end());
#define minv(a) min_element(a.begin(),a.end());
#define cnt(a,x) count(a.begin(),a.end(),x);
bool sortsec(const pair<int,int> &a,const pair<int,int> &b)
{
return (a.second < b.second);
}
int main(){
ll n,t,p;
cin>>n>>t>>p;
vector<int> solved(t);
vector<vector<int>> sarr(n);
int done;
fl(j, n){
fl(i, t){
cin>>done;
sarr[j].push_back(done);
solved[i]+=done;
}
}
vector<int> points(t);
fl(i, t){
points[i] = n-solved[i];
}
vector<pair<int, int>> fpoint;
fl(i, n){
int done=0;
int point=0;
fl(j, t){
if(sarr[i][j]){
done++;
point+=points[j];
}
}
fpoint.push_back({point, done});
}
int phil = fpoint[p-1].first, pdone=fpoint[p-1].second;
int rank=1;
fl(i, n){
if(i==p-1)continue;
if(fpoint[i].first>phil)rank++;
else if(fpoint[i].first==phil&&fpoint[i].second>pdone)rank++;
else if(fpoint[i].first==phil&&fpoint[i].second==pdone&&i<p-1)rank++;
}
cout<<phil<<sp<<rank;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |