Submission #956623

#TimeUsernameProblemLanguageResultExecution timeMemory
956623DeltaStructPoi (IOI09_poi)C++17
70 / 100
456 ms31812 KiB
#include <bits/stdc++.h> using namespace std; int main(){ #define int long long int n,m,q; cin >> n >> m >> q; vector A(n,vector<int>(m)); vector<int> B(m,n); for (int i(0);i < n;++i) for (int k(0);k < m;++k) (cin>>A[i][k]),B[k]-=A[i][k]; vector<int> C(n); iota(C.rbegin(),C.rend(),m*n); for (int i(0);i < n;++i) for (int k(0);k < m;++k) C[i] += A[i][k]*B[k]*n*(m+1)-A[q-1][k]*n; sort(C.begin(),C.end(),greater<int>()); int r(m*n+n-q); for (int k(0);k < m;++k) r += A[q-1][k]*B[k]*n*(m+1)-A[q-1][k]*n; cout << r/n/(m+1) << ' ' << upper_bound(C.begin(),C.end(),r,greater<int>())-C.begin() << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...