제출 #1364088

#제출 시각아이디문제언어결과실행 시간메모리
1364088val1262PPP (EGOI23_ppp)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
using namespace std;

const int MAX_JOURS = 2000000;
int nbParticipants, nbJours;
int prsnActu[MAX_JOURS], tps[MAX_JOURS][MAX_JOURS]; //[idM][idP]

void init() {
    cin >> nbParticipants >> nbJours;
    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;

        /*for (int idM = 0; idM < nbJours; idM++) {
            for (int idP = 0; idP < nbParticipants; idP++) {
                cout << tps[idM][idP] << ' ' ;
            }
            cout << '\n';
        }
        cout << '\n';*/
    }
}

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]++;
        //cout << "\n medaille num " << idM << " passe + de tps avec " << idTpsMax << '\n';
    }

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

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    init();
    jours();
    affiche();
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccN2wN5p.o: in function `init()':
Main.cpp:(.text+0x8): relocation truncated to fit: R_X86_64_PC32 against symbol `nbParticipants' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `nbJours' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `nbJours' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `prsnActu' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `nbParticipants' defined in .bss section in /tmp/ccN2wN5p.o
/tmp/ccN2wN5p.o: in function `jours()':
Main.cpp:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `nbJours' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0x125): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `prsnActu' defined in .bss section in /tmp/ccN2wN5p.o
Main.cpp:(.text+0x1ee): relocation truncated to fit: R_X86_64_PC32 against symbol `nbJours' defined in .bss section in /tmp/ccN2wN5p.o
/tmp/ccN2wN5p.o: in function `affiche()':
Main.cpp:(.text+0x255): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1f): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1ed): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x252): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2bc): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x316): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x50f): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x57d): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5f0): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x654): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status