結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー mayoko_mayoko_
提出日時 2016-07-09 16:51:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,369 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 107,872 KB
実行使用メモリ 5,632 KB
最終ジャッジ日時 2024-04-22 16:27:35
合計ジャッジ時間 6,593 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 72 ms
5,376 KB
testcase_11 AC 89 ms
5,376 KB
testcase_12 AC 85 ms
5,376 KB
testcase_13 AC 41 ms
5,376 KB
testcase_14 AC 59 ms
5,376 KB
testcase_15 AC 33 ms
5,376 KB
testcase_16 AC 97 ms
5,376 KB
testcase_17 AC 100 ms
5,632 KB
testcase_18 AC 101 ms
5,504 KB
testcase_19 AC 41 ms
5,376 KB
testcase_20 AC 55 ms
5,376 KB
testcase_21 AC 49 ms
5,376 KB
testcase_22 AC 84 ms
5,376 KB
testcase_23 AC 63 ms
5,376 KB
testcase_24 AC 41 ms
5,376 KB
testcase_25 AC 77 ms
5,376 KB
testcase_26 AC 52 ms
5,376 KB
testcase_27 AC 73 ms
5,376 KB
testcase_28 AC 39 ms
5,376 KB
testcase_29 AC 85 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 3 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 7 ms
5,376 KB
testcase_42 AC 6 ms
5,376 KB
testcase_43 AC 7 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 4 ms
5,376 KB
testcase_46 AC 21 ms
5,376 KB
testcase_47 AC 22 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXM = 111;
struct Score {
    int id;
    int solve;
    int penalty;
    Score() {}
    Score(int id, int solve, int penalty) : id(id), solve(solve), penalty(penalty) {}
    bool operator<(const Score& rhs) const {
        if (solve != rhs.solve) return solve > rhs.solve;
        return penalty < rhs.penalty;
    }
};

struct STP {
    int solve;
    int team;
    int penalty;
    STP() {}
    STP(int solve, int team, int penalty) : solve(solve), team(team), penalty(penalty) {}
    bool operator<(const STP& rhs) const {
        if (solve != rhs.solve) return solve < rhs.solve;
        if (team != rhs.team) return team > rhs.team;
        return penalty > rhs.penalty;
    }
};

vector<Score> univ[MAXM];
int now[MAXM];
const int INF = 1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    assert(1 <= N && N <= 100000 && 1 <= K && K <= N);
    for (int i = 0; i < N; i++) {
        int s, p, u;
        cin >> s >> p >> u;
        assert(0 <= s && s <= 10 && 0 <= p && p <= 1000000 && 1 <= u && u <= 100);
        univ[u].emplace_back(i, s, p);
    }
    for (int i = 0; i < MAXM; i++)
        sort(univ[i].begin(), univ[i].end());
    vector<int> ans;
    for (int i = 0; i < K; i++) {
        STP best(0, INF, INF);
        int index = -1;
        for (int j = 0; j < MAXM; j++) {
            if (now[j] == univ[j].size()) continue;
            STP tmp(univ[j][now[j]].solve, now[j], univ[j][now[j]].penalty);
            if (best < tmp) {
                best = tmp;
                index = j;
            }
        }
        assert(index != -1);
        ans.push_back(univ[index][now[index]].id);
        now[index]++;
    }
    for (int el : ans)
        cout << el << endl;
    return 0;
}
0