# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741771 | MODDI | Poi (IOI09_poi) | C++14 | 611 ms | 15972 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.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, t, k;
int mat[2001][2001];
struct state{
int points;
int cnt_solved;
int id;
};
bool comp(state& a, state& b){
if(a.points == b.points){
if(a.cnt_solved == b.cnt_solved)
return a.id < b.id;
else{
return a.cnt_solved > b.cnt_solved;
}
}
else
return a.points > b.points;
}
int main(){
cin>>n>>t>>k;
k--;
for(int i = 0; i < n; i++)
for(int j = 0; j < t; j++)
cin>>mat[i][j];
int points[t];
memset(points, 0, sizeof points);
for(int j = 0; j < t; j++){
for(int i = 0; i < n; i++){
if(mat[i][j] == 0)
points[j]++;
}
}
vector<state> arr;
for(int i = 0; i < n; i++){
int cnt = 0, pts = 0;
for(int j = 0; j < t; j++){
if(mat[i][j] == 1){
cnt++;
pts += points[j];
}
else
continue;
}
state now;
now.cnt_solved = cnt;
now.points = pts;
now.id = i;
arr.pb(now);
}
sort(arr.begin(), arr.end(), comp);
for(int i = 0; i < n; i++){
if(arr[i].id == k){
cout<<arr[i].points<<" "<<i+1<<endl;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |