# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
263602 | shrek12357 | Poi (IOI09_poi) | C++14 | 1086 ms | 23928 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 <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
using namespace std;
struct state {
int score;
int numTasks;
int index;
};
bool comp(state state1, state state2) {
if (state1.score != state2.score) {
return state1.score > state2.score;
}
if (state1.numTasks != state2.numTasks) {
return state1.numTasks > state2.numTasks;
}
return state1.index < state2.index;
}
#define MAXN 2005
int main() {
int n, t, p;
cin >> n >> t >> p;
int dp[MAXN][MAXN];
int tasks[MAXN];
for (int i = 0; i < t; i++) {
tasks[i] = 0;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
int temp;
cin >> temp;
if (temp == 0) {
tasks[j]++;
}
dp[i][j] = temp;
}
}
vector<state> people;
for (int i = 0; i < n; i++) {
int curScore = 0, counter = 0;
for (int j = 0; j < t; j++) {
if (dp[i][j] == 1) {
counter++;
curScore += tasks[j];
}
}
state temp = { curScore, counter, i + 1};
people.push_back(temp);
}
sort(people.begin(), people.end(), comp);
int ansScore = 0, ansIdx = 0;
for (int i = 0; i < people.size(); i++) {
if (people[i].index == p) {
ansScore = people[i].score;
ansIdx = i + 1;
}
}
cout << ansScore << " " << ansIdx << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |