# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099491 | shivamshaw23 | Poi (IOI09_poi) | C++17 | 170 ms | 23888 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;
#define ll long long int
#define mod 1000000007
ll phi(ll n) {
ll result = n;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0)
n /= i;
result -= result / i;
}
}
if (n > 1)
result -= result / n;
return result;
}
ll ncr(ll n,ll r){
if(r==0){
return 1;
}
ll ans=1,a=1,b=1;
if(n-r<r){
r=n-r;}
while(r){
a*=n;
b*=r;
ll g = __gcd(n,r);
a/=g;
b/=g;
n--;
r--;
ans=a/b;
}
return ans;
}
ll power(ll x,ll y){
ll res=1;
while(y>0){
if(y&1) res=(res*x);
y>>1; x=(x*x);
}return res;}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
ll n,t,p;cin>>n>>t>>p;
vector<int>points(t,0);
vector<vector<int>>v;
for(int i=0;i<n;i++){
vector<int>temp;
for(int j=0;j<t;j++){
ll a;cin>>a;
temp.push_back(a);
}
v.push_back(temp);
}
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
ll a=v[i][j];
points[j]+=a;
}
}
for(int i=0;i<t;i++){
points[i]=n-points[i];
}
vector<int>scores(n,0);
for(int i=0;i<n;i++){
ll a=0;
for(int j=0;j<t;j++){
if(v[i][j]==1){
a+=points[j];
}
}
scores[i]=a;
}
ll uwu = scores[p-1];
ll ans=0;
for(int i=0;i<p;i++){
if(uwu==scores[i])ans++;
}
for(int i=0;i<n;i++){
if(uwu<scores[i])ans++;
}
cout<<uwu<<" "<<ans<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |