제출 #799623

#제출 시각아이디문제언어결과실행 시간메모리
799623I_Love_EliskaM_Poi (IOI09_poi)C++14
100 / 100
187 ms40232 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define forn(i,n) for(int i=0;i<n;++i) #define pi pair<int,int> #define f first #define s second #define pb push_back #define all(x) x.begin(),x.end() #define vii(a,n) vector<int>a(n);forn(i,n)cin>>a[i]; struct z { int s,p,i; }; bool foo(z a, z b) { if (a.s > b.s) return 1; if (a.s < b.s) return 0; if (a.p > b.p) return 1; if (a.p < b.p) return 0; return a.i < b.i; } void solve() { int n,m,p; cin>>n>>m>>p; vector<z> a(n); vector<int> b(m,n); vector<vector<int>> c(n); forn(i,n) { forn(j,m) { int x; cin>>x; b[j]-=x; c[i].pb(x); } } forn(i,n) forn(j,m) a[i].p+=c[i][j], a[i].s+=c[i][j]*b[j]; forn(i,n) a[i].i=i; sort(all(a),foo); forn(i,n) if (a[i].i==p-1) { cout<<a[i].s<<' '<<i+1<<'\n'; } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...