| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 753952 | TimDee | Poi (IOI09_poi) | C++17 | 240 ms | 40272 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 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 time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
