Submission #1108944

#TimeUsernameProblemLanguageResultExecution timeMemory
1108944codinionPoi (IOI09_poi)C++14
85 / 100
383 ms24308 KiB
// https://oj.uz/problem/view/IOI09_poi #include <iostream> #include <vector> #include <algorithm> using namespace std; class Player { public: bool operator<(Player const& obj) { return this->score == obj.score ? this->count>obj.count : this->score > obj.score; } Player() { score = 0; count = 0; isPhilip = false; } void updateScore(int score) { this->score = score; } void updateCount(int count) { this->count = count; } int getScore() {return score;} vector<int> tasks; bool isPhilip; private: int score; int count; }; int main() { int N,T,P; cin>>N; cin>>T; cin>>P; int* solved = new int[T]; Player* arr = new Player[N]; for(int i=0;i<N;i++) { int cc = 0; for(int t = 0;t<T;t++) { int kt; cin>>kt; cc+=kt; if(kt == 1) solved[t]++; (arr[i].tasks).push_back(kt); } arr[i].updateCount(cc); if(i==P-1) arr[i].isPhilip = true; } for(int i=0;i<N;i++) { int ss = 0; for(int t = 0;t<T;t++) { ss+= ( (arr[i].tasks)[t] * (N-solved[t])); } arr[i].updateScore(ss); } sort(arr, arr+N); for(int i=0;i<N;i++) { // cout<<"Arr i : "<<i; // cout<<" tasks:"; // for(int t:arr[i].tasks) // { // cout<<" "<<t; // } // cout<<" Philip : "<<(arr[i].isPhilip?"Y":"N"); // cout<<endl; if(arr[i].isPhilip) { cout<<arr[i].getScore()<<" "<<i+1<<endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...