# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
963309 |
2024-04-14T20:36:31 Z |
anango |
Poi (IOI09_poi) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n,t,p;
cin >> n >> t >> p;
p--;
vector<int> tasks(n);
vector<vector<int>> solves(t,vector<int>(n));
vector<int> points(t,n);
for (int i=0; i<n; i++) {
for (int j=0; j<t; j++) {
int x;
cin >> x;
if (x==1) solves[j][i]++;
if (x==1) points[j]--;
}
}
vector<int> score(n,0);
vector<int> tasks(n,0);
for (int i=0; i<n; i++) {
for (int j=0; j<t; j++) {
if (solves[j][i])score[i]+=points[j];
if (solves[j][i])tasks[i]++;
}
//cout << score[i] <<" ";
}
vector<int> an;
for (int i=0; i<n; i++) {
an.push_back(i);
}
sort(an.begin(), an.end(), [=](const int x, const int y){
if (score[x]!=score[y]) {
return score[x]>score[y];
}
if (tasks[x]!=tasks[y]) {
return tasks[x]>tasks[y];
}
return x<y;
});
int c=-1;
for (int i=0; i<n; i++) {
if (an[i]==p) {
c=i+1;
}
}
cout << score[p] << " " << c << endl;
}
Compilation message
poi.cpp: In function 'int main()':
poi.cpp:21:14: error: redeclaration of 'std::vector<long long int> tasks'
21 | vector<int> tasks(n,0);
| ^~~~~
poi.cpp:9:14: note: 'std::vector<long long int> tasks' previously declared here
9 | vector<int> tasks(n);
| ^~~~~