Submission #956616

#TimeUsernameProblemLanguageResultExecution timeMemory
956616DeltaStructPoi (IOI09_poi)C++17
70 / 100
485 ms31808 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(),0); for (int i(0);i < n;++i) for (int k(0);k < m;++k) C[i] += A[i][k]*B[k]*n; sort(C.begin(),C.end(),greater<int>()); int r(n-q); for (int k(0);k < m;++k) r += A[q-1][k]*B[k]*n; assert(binary_search(C.begin(),C.end(),r,greater<int>())); cout << r/n << ' ' << upper_bound(C.begin(),C.end(),r,greater<int>())-C.begin() << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...