Submission #720669

#TimeUsernameProblemLanguageResultExecution timeMemory
720669AnjaJPoi (IOI09_poi)C++14
100 / 100
276 ms7996 KiB
#include <bits/stdc++.h> #include <cstring> using namespace std; struct Res{ int ID, Tasks, Points; Res(){ID = Tasks = Points = 0;} bool operator<(const Res &r) const{ if(Points != r.Points) return Points>r.Points; if(Tasks != r.Tasks) return Tasks>r.Tasks; return ID<r.ID; } }; int PhilID; int Contestants; int Tasks; vector<Res> Results(2001); bool T[2001][2001]; int Values[2001]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>Contestants>>Tasks>>PhilID; Results.resize(Contestants+1); for(int i=1; i<=Contestants; i++) { Results[i].ID = i; Results[i].Tasks = Results[i].Points = 0; } for(int i=1; i<=Tasks; i++) { Values[i] = Contestants; } for(int i=1; i<=Contestants; i++) { for(int j=1; j<=Tasks; j++) { cin>>T[i][j]; if(T[i][j]) { Values[j]--; Results[i].Tasks++; } } } for(int i=1; i<=Contestants; i++) { for(int j=1; j<=Tasks; j++) { if(T[i][j]) { Results[i].Points += Values[j]; } } } sort(Results.begin(), Results.end()); for(int i=0; i<Results.size(); i++) { if(Results[i].ID == PhilID) { cout<<Results[i].Points<<" "<<i+1<<'\n'; } } return 0; /*for(int i=1; i<=Tasks; i++) { cout<<Values[i]<<" "; }*/ /*cout<<endl; for(int i=1; i<=Contestants; i++) { for(int t : Results[i]) { cout<<t<<" "; } cout<<endl; }*/ }

Compilation message (stderr)

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