# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262216 | BlancaHM | Poi (IOI09_poi) | C++14 | 363 ms | 22944 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.
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>
#include <climits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
vi points, solved, solvedP;
bool comp(int i, int j) {
if (points[i] > points[j]) return true;
else if (points[i] < points[j]) return false;
else if (solvedP[i] > solvedP[j]) return true;
else if (solvedP[i] < solvedP[j]) return false;
else return i < j;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int N, T, P;
cin >> N >> T >> P;
int grid[N][T], play[N];
points.assign(N, 0);
solvedP.assign(N, 0);
solved.assign(T, 0);
for (int i = 0; i < N; i++) {
play[i] = i;
for (int j = 0; j < T; j++) {
cin >> grid[i][j];
}
}
for (int i = 0; i < T; i++) {
for (int j = 0; j < N; j++) solved[i] += grid[j][i];
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < T; j++) {
if (grid[i][j]) {
points[i] += (N-solved[j]);
solvedP[i]++;
}
}
}
sort(play, play+N, comp);
for (int i = 0; i < N; i++) {
if (play[i] == P-1) {
cout << points[P-1] << " " << i+1 << "\n";
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |