# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340584 | rocks03 | Poi (IOI09_poi) | C++14 | 317 ms | 23916 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |