Submission #1307843

#TimeUsernameProblemLanguageResultExecution timeMemory
1307843ayazCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
#include "grader.c"

using namespace std;

#define all(x) (x).begin(), (x).end()
#define isz(x) int(x.size())

using vi = vector<int>;
using ll = long long;
using pii = pair<int, int>;

const int inf = 1e9;
void exploreCave(int N) {
  int n = N;
  int s[n], d[n];
  fill(s, s + n, 1);
  fill(d, d + n, inf);
  for (int _ = 1; _ <= n; _++) {
    if (tryCombination(s) == -1) {
      break;
    }
    int idx = tryCombination(s);
    for (int i = 0; i < n; i++) {
      if (s[i] == 0) continue;
      s[i] = 0;
      int cur = tryCombination(s);
      if (cur == -1 || cur > idx) {
        d[i] = idx;
        break;
      }
      s[i] = 1;
    }
  }
  fill(s, s + n, 0);
  for (int _ = 1; _ <= n; _++) {
    if (tryCombination(s) == -1) {
      break;
    }
    int idx = tryCombination(s);
    for (int i = 0; i < n; i++) {
      if (s[i] == 1) continue;
      s[i] = 1;
      int cur = tryCombination(s);
      if (cur > idx) {
        d[i] = idx;
        break;
      }
      s[i] = 0;
    }
  }
  answer(s, d);
}

Compilation message (stderr)

In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from cave.cpp:1:
In function 'constexpr typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int*; _Tp = int]',
    inlined from 'constexpr void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int*; _Tp = int]' at /usr/include/c++/13/bits/stl_algobase.h:977:21,
    inlined from 'constexpr void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int*; _Tp = int]' at /usr/include/c++/13/bits/stl_algobase.h:1007:20,
    inlined from 'void exploreCave(int)' at cave.cpp:36:7:
/usr/include/c++/13/bits/stl_algobase.h:931:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' specified bound between 18446744065119617024 and 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  931 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
/usr/bin/ld: /tmp/ccrOzrhA.o: in function `answer':
grader.c:(.text+0x0): multiple definition of `answer'; /tmp/ccR8Qhp7.o:cave.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccrOzrhA.o: in function `tryCombination':
grader.c:(.text+0x80): multiple definition of `tryCombination'; /tmp/ccR8Qhp7.o:cave.cpp:(.text+0x80): first defined here
/usr/bin/ld: /tmp/ccrOzrhA.o: in function `init()':
grader.c:(.text+0x110): multiple definition of `init()'; /tmp/ccR8Qhp7.o:cave.cpp:(.text+0x110): first defined here
/usr/bin/ld: /tmp/ccrOzrhA.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccR8Qhp7.o:cave.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status