제출 #1364105

#제출 시각아이디문제언어결과실행 시간메모리
1364105val1262PPP (EGOI23_ppp)C++20
16 / 100
3094 ms16096 KiB
#include <iostream>
#include <vector>
using namespace std;

const int MAX_JOURS = 2000;
int nbParticipants, nbJours;
int prsnActu[MAX_JOURS], tps[MAX_JOURS][MAX_JOURS];

void solveSousTache1() {
    vector<int> g(nbJours), p(nbJours);
    for (int i = 0; i < nbJours; i++) cin >> g[i] >> p[i];
    vector<int> res(2, 0);
    for (int m = 0; m < nbJours; m++) {
        int poss = g[m];
        int t0 = 0, t1 = 0;

        for (int j = m; j < nbJours; j++) {
            if (poss == 0) t0++;
            else t1++;
            if (p[j] == poss) poss = g[j];
        }

        if (t0 >= t1) res[0]++;
        else res[1]++;
    }
    cout << res[0] << ' ' << res[1] << '\n';
}

void init() {
    for (int idM = 0; idM < nbJours; idM++) {
        prsnActu[idM] = -1;
        for (int idP = 0; idP < nbParticipants; idP++) {
            tps[idM][idP] = -1;
        }
    }
}

void jours() {
    for (int idJ = 0; idJ < nbJours; idJ++) {
        int x, y;
        cin >> x >> y;

        for (int idM = 0; idM < idJ; idM++) {
            if (prsnActu[idM] == y) {
                prsnActu[idM] = x;
                if (tps[idM][x] == -1) tps[idM][x] = 0;
            }
            tps[idM][prsnActu[idM]]++;
        }
        prsnActu[idJ] = x;
        tps[idJ][x] = 1;
    }
}

void affiche() {
    vector<int> nbMedailles(nbParticipants, 0);
    for (int idM = 0; idM < nbJours; idM++) {
        int idTpsMax = 0;
        for (int idP = 0; idP < nbParticipants; idP++) {
            if (tps[idM][idP] > tps[idM][idTpsMax]) {
                idTpsMax = idP;
            }
        }
        nbMedailles[idTpsMax]++;
    }

    for (int idP = 0; idP < nbParticipants; idP++) {
        cout << nbMedailles[idP] << ' ';
    }
    cout << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> nbParticipants >> nbJours;
    if (nbParticipants == 2) {
        solveSousTache1();
        return 0;
    }
    init();
    jours();
    affiche();
    return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…