# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741770 | MODDI | Poi (IOI09_poi) | C++14 | 587 ms | 23852 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) return true;
else if(a.points > b.points) return false;
else{
if(a.cnt_solved > b.cnt_solved) return false;
else if(a.cnt_solved < b.cnt_solved) return true;
else{
if(a.id < b.id) return true;
return false;
}
}
}
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 solved[t];
memset(solved, 0, sizeof solved);
for(int j = 0; j < t; j++){
for(int i = 0; i < n; i++){
solved[j] += mat[i][j];
}
}
int points[t];
for(int j = 0; j < t; j++)
points[j] = n - solved[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];
}
}
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... |