Submission #1157886

#TimeUsernameProblemLanguageResultExecution timeMemory
1157886aligay100infaShopping (JOI21_shopping)C++20
Compilation error
0 ms0 KiB
#include "Anna.h" #include <iostream> #include <vector> using namespace std; namespace { int n, l, r, k, count, ans, idx, a[1000001]; void send(int x) { for (int i = 0; i < 9; i++) SendA((x >> i) & 1); } } // namespace void InitA(int N, int L, int R) { n = N; l = L; r = R; idx = count = 0; } void find() { int mn = l; for (int i = l; i <= r; i++) { if (a[i] < a[mn]) mn = i; } ans = mn; } void ReceiveA(bool x) { if (count >= 10) { count = 0; idx++; } a[idx] |= x << count; count++; //if (count == 10) printf("%d ", a[idx]); if (idx == n - 1 && count == 10) { find(); } } int Answer() { return ans; }
#include "Bruno.h" #include <vector> using namespace std; namespace { int n, a[1000000], count, l, r, k; bool stillF = true; } // namespace void send(int x) { for (int i = 0; i < 10; i++) SendB((x >> i) & 1); } void InitB(int N, std::vector<int> P) { n = N; for(int i = 0; i < N; i++) { a[i] = P[i]; send(a[i]); } count = 0; k = 1; } void solve() { if (l == r) send(0); else { int mn = 0; for (int i = (l + 1) * k; i < r * k; i++) { if (a[i] < a[mn]) mn = i; } send(mn); } } void ReceiveB(bool y) { if (count < 9 && stillF) { l |= y << count; count++; } else if (count < 9) { r |= y << count; count++; if (count == 9) { solve(); } } else { count = 0; stillF = false; } }

Compilation message (stderr)

# 1번째 컴파일 단계

Anna.cpp: In function 'void InitA(int, int, int)':
Anna.cpp:21:9: error: reference to 'count' is ambiguous
   21 |   idx = count = 0;
      |         ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Anna.cpp: In function 'void ReceiveA(bool)':
Anna.cpp:33:7: error: reference to 'count' is ambiguous
   33 |   if (count >= 10) {
      |       ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Anna.cpp:34:5: error: reference to 'count' is ambiguous
   34 |     count = 0;
      |     ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Anna.cpp:37:18: error: reference to 'count' is ambiguous
   37 |   a[idx] |= x << count;
      |                  ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Anna.cpp:38:3: error: reference to 'count' is ambiguous
   38 |   count++;
      |   ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Anna.cpp:40:23: error: reference to 'count' is ambiguous
   40 |   if (idx == n - 1 && count == 10) {
      |                       ^~~~~
Anna.cpp:9:17: note: candidates are: 'int {anonymous}::count'
    9 | int n, l, r, k, count, ans, idx, a[1000001];
      |                 ^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Anna.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~