# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1029029 | vjudge1 | Poi (IOI09_poi) | C++17 | 212 ms | 23892 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 <bits/stdc++.h>
#define _CRT_SECURE_NO_DEPRECATE
#define LSOne(S) ((S) & -(S))
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
const int INF = 1e9;
const long long LLINF = 4e18;
const double EPS = 1e-9;
/************************* Collection *****************************************/
// memset(memo, -1, sizeof memo);
// initialize DP memoization table with -1
// memset(arr, 0, sizeof arr); to clear array of integers
// set<T> s(a.begin(), a.end());
// a.resize(n, val);
// unique(a.begin(), a.end()) return new end pointer
/*************************** Sort *********************************************/
// binary_search(a.begin(), a.end(), value); // bool value return
/*************************** Misc *********************************************/
// index = (index + n - 1) % n; // index--; if (index < 0) index = n - 1;
// int ans = (int)((double)d + 0.5); // for rounding to nearest integer or
// round()
/************************************** Format ********************************/
// Format String "%a.*lf" - set precision
// Format String "%a.blf" - b digit after ., a field precision
// Format String "%[0-9]", "%[a-zA-Z]"
// Format String "%3000[^\n]" input string upto 3000 and endline
// Space before %c consume whitespace
// %% print %
// sscanf, fgets, memmove, snprintf, strsep, isalpha, isnumber, isalnum,
// string(begin(), end()), string(num, char), string.append(),
// string.push_back(), string.find(), string.find_first_of(), find_last_of(),
// find_first_not_of(), find_last_not_of(), distance(), find()
/************************************** Permutation ***************************/
// next_permutation(s.begin(), s.end());
// prev_permutation(s.begin(), s.end());
/*************************************** Algo*********************************/
// replace(begin(), end(), val1, replace)
struct ta {
int num_solve;
int score;
int id;
};
int main() {
int n, t, p;
scanf("%d%d%d", &n, &t, &p);
vector<vector<int>> a(n, vector<int>(t));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
scanf("%d", &a[i][j]);
}
}
vi score(t, n);
vector<ta> point(n);
for (int i = 0; i < t; i++) {
for (int j = 0; j < n; j++) {
score[i] -= a[j][i];
}
}
for (int i = 0; i < n; i++) {
point[i].num_solve = 0;
point[i].score = 0;
point[i].id = i + 1;
for (int j = 0; j < t; j++) {
point[i].score += a[i][j] * score[j];
point[i].num_solve += a[i][j];
}
}
sort(point.begin(), point.end(), [](ta &a, ta &b) {
if (a.score != b.score) {
return a.score > b.score;
}
if (a.num_solve != b.num_solve) {
return a.num_solve > b.num_solve;
}
return a.id < b.id;
});
for (int i = 0; i < n; i++) {
if (point[i].id == p) {
printf("%d %d\n", point[i].score, i + 1);
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |