# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
277109 | barsbold | Poi (IOI09_poi) | C++14 | 348 ms | 5112 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>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pb push_back
#define ll long long
using namespace std;
bool a[2001][2001];
int tasks[2001];
pair<int , int > score [2001];
vector<int > hel;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n , t, p;
cin >> n >> t >> p;
memset(score , 0 , sizeof(score));
for(int i = 1; i<=n; i++){
for(int j = 1; j<=t; j++){
cin >> a[i][j];
if(a[i][j] == 0){
tasks[j]++;
}
}
}
for(int i = 1; i<=n; i++){
score[i].ss = i;
for(int j = 1; j<=t; j++){
if(a[i][j] == 1 ){
score[i].ff+=tasks[j];
}
}
}
int pl = score[p].ff;
sort(score +1 , score + n + 1);
for(int i = n; i>=1; i--){
if(score[i].ff == pl){
hel.pb(score[i].ss);
}
}
sort(hel.begin(), hel.end());
int rat =0;
for(int i = 0; i<hel.size(); i++){
if(hel[i] == p){
rat = i;
break;
}
}
for(int i = n; i>=1; i--){
if(score[i - 1].ff == pl){
cout << pl << " " << n - i + 2 + rat << endl;
return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |