Submission #798110

#TimeUsernameProblemLanguageResultExecution timeMemory
798110YassirSalamaPoi (IOI09_poi)C++14
100 / 100
176 ms35556 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 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 void dbg_out() { cout << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); } #define dbg(...) cout << "[ " << #__VA_ARGS__<< "] :", dbg_out(__VA_ARGS__); struct st{ int id; int score; int ntasks; bool operator < (const st& other) const{ if(score==other.score) { if(ntasks==other.ntasks) return id<other.id; return ntasks>other.ntasks; } 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]; // memset(arr,n,sizeof(arr)); for(int i=0;i<t;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; int nt=0; for(int j=0;j<t;j++){ sc+=v[i][j]*arr[j]; nt+=v[i][j]; } // cout<<i+1<<" "<<sc<<" "<<nt<<endl; vv.push_back({.id=i+1,.score=sc,.ntasks=nt}); } sort(all(vv)); for(int i=0;i<n;i++){ // dbg(vv[i].id,vv[i].score,vv[i].ntasks); if(vv[i].id==p){ cout<<vv[i].score<<" "<<i+1<<endl; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...