Submission #362284

#TimeUsernameProblemLanguageResultExecution timeMemory
362284AzizCherifPoi (IOI09_poi)C++14
0 / 100
357 ms21996 KiB
//ASSLEMA :) #include <bits/stdc++.h> using namespace std; #define boost ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) typedef long long ll; typedef double db; typedef long double ldb; //#define int ll //.................................................................. typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<db> vdb; typedef vector<string> vs; typedef vector<pi> vpi; typedef vector<pll> vpll; #define mp make_pair #define pb push_back #define fi first #define se second #define sz(v) ((int)v.size()) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define endl '\n' ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; } ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); } void IO() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b){ if(a.fi.fi>b.fi.fi)return false; else{ if(a.fi.fi==b.fi.fi){ if(a.fi.se>b.fi.se) return false; else if(a.fi.se==b.fi.se){ if(a.se>b.se)return false; } else return true; } else return true; } } int32_t main(){ boost; IO(); int n, t, p; cin>>n>>t>>p; vector<vi> input(n); for(int i=0; i<n; i++){ vi temp; for(int j=0; j<t; j++){ int x; cin>>x; temp.pb(x); } input[i]=temp; } vi scores(t); scores.assign(t, n); for(int i=0; i<t; i++){ for(int j=0; j<n; j++){ if(input[j][i]==1){ scores[i]--; } } } vector<pair<pi, int>> board;//score, nb_poblems, ' ' , ID for(int i=0; i<n; i++){ int sc=0, nb=0; for(int j=0; j<t; j++){ if(input[i][j]==1){ sc+=scores[j]; nb++; } } board.pb(mp(mp(sc, nb), i+1)); } sort(all(board), cmp); for(int i=0; i<n; i++){ if(board[i].se==p){ cout<<board[i].fi.fi<<' '<<i+1; break; } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'bool cmp(std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>)':
poi.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...