Submission #504698

# Submission time Handle Problem Language Result Execution time Memory
504698 2022-01-10T07:43:48 Z SanguineChameleon Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "speedrun.h"

void dfs1(int u, int N, bool flag[]) {
    for (int i = 1; i <= N; i++) {
        if (getHint(i) && !flag[i]) {
            flag[i] = true;
            goTo(i);
            dfs1(i, N, flag);
            goTo(u);
        }
    }
}

void ass1(int N, int A[], int B[]) {
    setHintLen(N);
    for (int i = 1; i <= N - 1; i++) {
        setHint(A[i], B[i], 1);
        setHint(B[i], A[i], 1);
    }
}

void speed1(int N, int start) {
    bool flag[N];
    fill_n(flag, N, false);
    dfs1(start, N, flag);
}

void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
    if (subtask == 1) {
        ass1(N, A, B);
    }
}

void speedrun(int subtask, int N, int start) { /* your solution here */
    if (subtask == 1) {
        speed1(N, start);
    }
}

Compilation message

speedrun.cpp: In function 'void speed1(int, int)':
speedrun.cpp:26:5: error: 'fill_n' was not declared in this scope; did you mean 'std::fill_n'?
   26 |     fill_n(flag, N, false);
      |     ^~~~~~
      |     std::fill_n
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from speedrun.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:1089:5: note: 'std::fill_n' declared here
 1089 |     fill_n(_OI __first, _Size __n, const _Tp& __value)
      |     ^~~~~~