Submission #340584

#TimeUsernameProblemLanguageResultExecution timeMemory
340584rocks03Poi (IOI09_poi)C++14
100 / 100
317 ms23916 KiB
//#pragma GCC target("avx2") //#pragma GCC optimization("O3") //#pragma GCC optimization("unroll-loops") #include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); struct contestant{ int score, sum, id; bool operator<(const contestant& other) const{ if(score == other.score){ if(sum == other.sum){ return id < other.id; } return sum > other.sum; } return score > other.score; } }; void solve(){ int N, T, P; cin >> N >> T >> P; --P; vector<int> score(T, N); int task[N][T]; for(int i = 0; i < N; i++){ for(int t = 0; t < T; t++){ cin >> task[i][t]; if(task[i][t]) score[t]--; } } contestant a[N]; for(int i = 0; i < N; i++){ a[i].score = a[i].sum = 0; a[i].id = i; for(int t = 0; t < T; t++){ if(task[i][t]){ a[i].score += score[t]; a[i].sum++; } } } sort(a, a+N); for(int i = 0; i < N; i++){ if(a[i].id == P){ cout << a[i].score << " " << i + 1; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...