Submission #535859

#TimeUsernameProblemLanguageResultExecution timeMemory
535859cig32Poi (IOI09_poi)C++17
100 / 100
286 ms12148 KiB
#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)

poi.cpp: In function 'int main()':
poi.cpp:55:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<con>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i=0;i<A.size();i++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...