Submission #732972

#TimeUsernameProblemLanguageResultExecution timeMemory
732972Roman70Poi (IOI09_poi)C++17
0 / 100
217 ms27068 KiB
#include "bits/stdc++.h" #define forn(i,n) for(int i = 0;i<n;i++) #define ll long long #define pb push_back #define sz(a) a.size() using namespace std; struct player{ int points = 0; int p =0; vector<int>t; int id; }; bool cmp(player a, player b){ if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id ); } void solve() { int n,p,m; cin >> n >> p >> m; player pl[n]; int puncte[p]; memset(puncte,0,sizeof(puncte)); forn(i,n){ pl[i].id = i; forn(j,p){ int t; cin >> t; if(t) {pl[i].t.push_back(j);} else puncte[j]++; } } forn(i,n){ pl[i].p = pl[i].t.size(); for(auto prob : pl[i].t) pl[i].points += puncte[prob]; } sort(pl,pl+n,cmp); forn(i,n) { if(pl[i].id == p){ cout<<pl[i].points<<" "<<i+1<<"\n"; break; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); // cout << 4; int t = 1; // cin >> t; while(t--) solve(); return 0; }

Compilation message (stderr)

poi.cpp: In function 'bool cmp(player, player)':
poi.cpp:19:52: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   19 |     if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
      |                               ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
poi.cpp:19:102: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   19 |     if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
      |                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
poi.cpp:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...