# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108950 | codinion | Poi (IOI09_poi) | C++14 | 382 ms | 16456 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.
// 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->id<obj.id : 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;
int id;
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;
arr[i].id = i+1;
}
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |