Submission #758903

#TimeUsernameProblemLanguageResultExecution timeMemory
758903akarinkofPoi (IOI09_poi)C++14
100 / 100
477 ms39628 KiB
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P1;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<string,ll> Ps;
typedef pair<pair<ll,ll>,pair<ll,ll> > P4;


#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,s,e) for(ll i=s;i<=e;++i)
#define FFOR(i,s,e) for(ll i=s;i>=e;--i)

#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define ALL(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define vs vector<string>
#define so(a) sort(a.begin(),a.end())

#define fi first
#define se second
#define print(a) cout<<a<<endl
#define ssize(a) (ll)(a.size())

#define MAX_N 1002
#define i197 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


const ll INF=1000000000000000001;
struct edge
{
	int to, cost;
};

struct pos{
	// 1 変数を入れる;
	ll t;
	ll x,y;
	set<ll> st;

};
int dx[4] = { 1, 0, -1, 0};
int dy[4] = { 0, 1, 0, -1};
int dd[5] = { 0, 1, 0, -1, 0};





int main(){

	ll n,t,p;
	cin>>n>>t>>p;


	ll c[t+5][n+5];
	vl score(t+5,n);
	vl total(n+5),task(n+5);
	FOR(i,1,n){
		rep(j,t){
			cin>>c[j][i];
			score[j]-=c[j][i];
			task[i]+=c[j][i];
		}
	}
	FOR(i,1,n)rep(j,t)total[i]+=score[j]*c[j][i];

	vector<P3> a(n);
	FOR(i,1,n)a[i-1]=mp(mp(total[i],task[i]),n-i);

	sort(a.begin(),a.end(),greater<P3>());

	rep(i,n){
		if(n-a[i].se==p){
			cout<<a[i].fi.fi<<" "<<i+1<<endl;
		}
	}

	return 0;

}














#Verdict Execution timeMemoryGrader output
Fetching results...