Submission #387726

#TimeUsernameProblemLanguageResultExecution timeMemory
387726gouravkhungerPoi (IOI09_poi)C++17
100 / 100
346 ms12192 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define vi vector<int> #define tiii tuple<int, int, int> #define vpii vector<pair<int, int>> #define FOR(i, a, b) for(int i=a;i<=b;i++) #define PB push_back #define F first #define S second #define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int main() { FIO; int n, t, p, s=0, r = 0; cin>>n>>t>>p; vi scores(t, 0); //scores of the problems // 0: score // 1: number of tasks // 2: id vector<tuple<int, int, int>> final(n); bool a[n][t]; //solved or !solved FOR(i, 0, n-1){ FOR(j, 0, t-1){ cin>>a[i][j]; if(a[i][j]) scores[j]++; } } FOR(i, 0, t-1) scores[i] = abs(scores[i]-n); FOR(j, 0, t-1){ if(a[p-1][j]) s+=scores[j]; } FOR(i, 0, n-1){ final[i] = {0, 0, n-(i+1)}; FOR(j, 0, t-1){ if(a[i][j]){ get<1>(final[i])++; get<0>(final[i])+=scores[j]; } } //cout<<get<0>(final[i])<<" "<<get<1>(final[i])<<" "<<get<2>(final[i])<<"\n"; } sort(all(final), greater<tuple<int, int, int>>()); /*cout<<"\n\n"; FOR(i, 0, n-1){ cout<<get<0>(final[i])<<" "<<get<1>(final[i])<<" "<<get<2>(final[i])<<"\n"; }*/ FOR(i, 0, n-1){ if(get<2>(final[i])==(n-p)) r = i+1; } cout<<s<<" "<<r; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...