# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
263602 | shrek12357 | Poi (IOI09_poi) | C++14 | 1086 ms | 23928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |