Submission #1114896

# Submission time Handle Problem Language Result Execution time Memory
1114896 2024-11-19T18:00:59 Z ortsac Dancing Elephants (IOI11_elephants) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>
#define fr first
#define se second

int32_t main() {
    int n, s;
    cin >> n >> s;
    vector<pii> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].fr;
        v[i].fr++;
        v[i].fr %= s;
        v[i].se = (i + 1);
    }
    sort(v.begin(), v.end());
    vector<pii> ord;
    int mi = 1e9;
    do {
        int qtd = 0;
        int pf = 0;
        for (int i = 0; i < (n - 1); i++) {
            pf = ((pf + v[i].fr) % s);
            if (pf == (s - 1)) {
                qtd++;
                pf = 0;
            }
        }
        if (qtd < mi) {
            mi = qtd;
            ord = v;
        }
    } while (next_permutation(v.begin(), v.end()));
    cout << mi << "\n";
    for (auto u : ord) cout << u.se << " ";
    cout << "\n";
}

Compilation message

/usr/bin/ld: /tmp/cchOQy6v.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cco2hJXv.o:elephants.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cchOQy6v.o: in function `main':
grader.cpp:(.text.startup+0x27): undefined reference to `init(int, int, int*)'
/usr/bin/ld: grader.cpp:(.text.startup+0x56): undefined reference to `update(int, int)'
collect2: error: ld returned 1 exit status