Submission #798089

#TimeUsernameProblemLanguageResultExecution timeMemory
798089YassirSalamaPoi (IOI09_poi)C++14
10 / 100
179 ms57796 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <limits>
#include <map>
#include <utility>
#include <cctype>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <functional>
#include <iterator>
using namespace std;
#define OVL(x,s) for(auto y:x) cout<<y<<s; cout<<"\n";
#define dbg(x) cout << "[ " << #x << " ] : " << x<<endl;
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define ll long long
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define int long long

struct st{
	int id;
	int score;
	bool operator < (const st& other) const{
		if(score==other.score) return id<other.id;
		return score>other.score;
	}
};
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n,t,p;
cin>>n>>t>>p;
int arr[t];
for(int i=0;i<n;i++) arr[i]=n;
vector<vector<int>> v(n,vector<int>(t,0));
for(int i=0;i<n;i++){
	for(int j=0;j<t;j++){
		cin>>v[i][j];
		arr[j]-=v[i][j];
	}
}
vector<st> vv;
for(int i=0;i<n;i++){
	int sc=0;
	for(int j=0;j<t;j++){
		sc+=v[i][j]*arr[j];
	}
	vv.push_back({.id=i+1,.score=sc,});
}
sort(all(vv));
for(int i=0;i<n;i++){
	if(vv[i].id==p){
		cout<<vv[i].score<<" "<<i+1<<endl;
		return 0;
	}
}
}
#Verdict Execution timeMemoryGrader output
Fetching results...