# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
535859 | cig32 | Poi (IOI09_poi) | C++17 | 286 ms | 12148 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 LL long long
#define INF INT_MAX
#define LD long double
#define endl '\n'
#define output for(LL i=0;i<sizex;i++) { for(LL j=0;j<sizey;j++) { cout << A[i][j] << " "; }cout<<endl; }cout<<endl;
struct con{
int ID, tasks, points;
con(){ ID = tasks = points = 0; }
bool operator < ( const con &o ) const{
if( points != o.points ) return points > o.points;
if( tasks != o.tasks ) return tasks > o.tasks;
return ID < o.ID;
}
};
const int maxN = 2001;
int N, T, ID;
int points[maxN];
vector <con> A(maxN);
bool M[maxN][maxN];
int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> N >> T >> ID;
A.resize(N+1);
for(int i=1;i<=N;i++) { A[i].ID = i; A[i].tasks = A[i].points = 0; }
for(int i=1;i<=T;i++) points[i] = N;
for(int i=1;i<=N;i++) for(int j=1;j<=T;j++){
cin >> M[i][j];
if( M[i][j] ) { points[j]--; A[i].tasks++; }
}
// for(int i=1;i<=T;i++) cout << i << ": " << points[i] << endl;
// cout << endl;
for(int i=1;i<=N;i++) for(int j=1;j<=T;j++){
if( M[i][j] ) A[i].points += points[j];
}
sort( A.begin(), A.end() );
// for(int i=0;i<A.size();i++){
// cout << A[i].ID << ": " << A[i].tasks << ' ' << A[i].points << endl;
// }
for(int i=0;i<A.size();i++){
if( A[i].ID == ID ){
cout << A[i].points << ' ' << i+1 << endl; return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |