Submission #1041881

#TimeUsernameProblemLanguageResultExecution timeMemory
1041881juicyTwo Transportations (JOI19_transportations)C++17
Compilation error
0 ms0 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; namespace { void __print() { cerr << "]\n"; } template<class T, class... V> void __print(T t, V... v) { cerr << t; if (sizeof...(v)) { cerr << ", "; } __print(v...); } #define debug(x...) cerr << "[" << #x << "] = ["; __print(x); const int inf = 1e9; int N, MX, value, index, cur, best, ver; vector<int> D; vector<bool> vis; vector<vector<array<int, 2>>> g; void send(int x, int b) { for (int i = 0; i < b; ++i) { SendA(x >> i & 1); } } void add(int u) { vis[u] = 1; MX = D[u]; for (auto [v, w] : g[u]) { D[v] = min(D[v], D[u] + w); } } void upd() { index = -1; for (int i = 0; i < N; ++i) { if (!vis[i] && (index == -1 || D[i] < D[index])) { index = i; } } if (~index) { best = min(501, D[index] - MX); send(best, 9); } } } void ReceiveA(bool x) { if (cur < 9) { if (x) { value += 1 << cur; } if (++cur == 9 && best < value) { send(index, 11); add(index); value = cur = 0; upd(); } } else { if (x) { ver += 1 << cur - 9; } if (++cur == 20) { D[ver] = min(D[ver], value + MX); add(ver); value = cur = ver = 0; upd(); } } } void InitA(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> C) { ::N = N; vis.resize(N); g.resize(N); D.resize(N, inf); MX = 0; for (int i = 0; i < M; ++i) { g[U[i]].push_back({V[i], C[i]}); g[V[i]].push_back({U[i], C[i]}); } vis[0] = 1; D[0] = 0; add(0); upd(); } vector<int> Answer() { return D; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; namespace { void __print() { cerr << "]\n"; } template<class T, class... V> void __print(T t, V... v) { cerr << t; if (sizeof...(v)) { cerr << ", "; } __print(v...); } #define debug(x...) cerr << "[" << #x << "] = ["; __print(x); const int inf = 1e9; int N, MX, value, index, cur, best, ver; vector<int> D; vector<bool> vis; vector<vector<array<int, 2>>> g; void send(int x, int b) { for (int i = 0; i < b; ++i) { SendB(x >> i & 1); } } void add(int u) { vis[u] = 1; MX = D[u]; for (auto [v, w] : g[u]) { D[v] = min(D[v], D[u] + w); } } void upd() { index = -1; for (int i = 0; i < N; ++i) { if (!vis[i] && (index == -1 || D[i] < D[index])) { index = i; } } if (~index) { best = min(501, D[index] - MX); send(best, 9); } } } void InitB(int N, int M, std::vector<int> S, std::vector<int> T, std::vector<int> W) { ::N = N; g.resize(N); vis.resize(N); D.resize(N, inf); MX = 0; for (int i = 0; i < M; ++i) { g[S[i]].push_back({T[i], W[i]}); g[T[i]].push_back({S[i], W[i]}); } vis[0] = 1; D[0] = 0; add(0); upd(); } void ReceiveB(bool y) { if (cur < 9) { if (y) { value += 1 << cur; } if (++cur == 9 && best < value) { send(index, 11); add(index); value = cur = 0; upd(); } } else { if (y) { ver += 1 << cur - 9; } if (++cur == 20) { D[ver] = min(D[ver], value + MX); add(ver); value = cur = ver = 0; upd(); } } }

Compilation message (stderr)

Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:64:12: error: reference to 'index' is ambiguous
   64 |       send(index, 11);
      |            ^~~~~
Azer.cpp:25:21: note: candidates are: 'int {anonymous}::index'
   25 |   int N, MX, value, index, cur, best, ver;
      |                     ^~~~~
In file included from /usr/include/string.h:432,
                 from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from Azer.cpp:3:
/usr/include/strings.h:61:1: note:                 'const char* index(const char*, int)'
   61 | index (const char *__s, int __c) __THROW
      | ^~~~~
/usr/include/strings.h:55:1: note:                 'char* index(char*, int)'
   55 | index (char *__s, int __c) __THROW
      | ^~~~~
Azer.cpp:65:11: error: reference to 'index' is ambiguous
   65 |       add(index);
      |           ^~~~~
Azer.cpp:25:21: note: candidates are: 'int {anonymous}::index'
   25 |   int N, MX, value, index, cur, best, ver;
      |                     ^~~~~
In file included from /usr/include/string.h:432,
                 from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from Azer.cpp:3:
/usr/include/strings.h:61:1: note:                 'const char* index(const char*, int)'
   61 | index (const char *__s, int __c) __THROW
      | ^~~~~
/usr/include/strings.h:55:1: note:                 'char* index(char*, int)'
   55 | index (char *__s, int __c) __THROW
      | ^~~~~
Azer.cpp:71:23: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   71 |       ver += 1 << cur - 9;
      |                   ~~~~^~~
Azer.cpp: At global scope:
Azer.cpp:8:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
    8 |   void __print() {
      |        ^~~~~~~

Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:80:12: error: reference to 'index' is ambiguous
   80 |       send(index, 11);
      |            ^~~~~
Baijan.cpp:25:21: note: candidates are: 'int {anonymous}::index'
   25 |   int N, MX, value, index, cur, best, ver;
      |                     ^~~~~
In file included from /usr/include/string.h:432,
                 from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from Baijan.cpp:3:
/usr/include/strings.h:61:1: note:                 'const char* index(const char*, int)'
   61 | index (const char *__s, int __c) __THROW
      | ^~~~~
/usr/include/strings.h:55:1: note:                 'char* index(char*, int)'
   55 | index (char *__s, int __c) __THROW
      | ^~~~~
Baijan.cpp:81:11: error: reference to 'index' is ambiguous
   81 |       add(index);
      |           ^~~~~
Baijan.cpp:25:21: note: candidates are: 'int {anonymous}::index'
   25 |   int N, MX, value, index, cur, best, ver;
      |                     ^~~~~
In file included from /usr/include/string.h:432,
                 from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from Baijan.cpp:3:
/usr/include/strings.h:61:1: note:                 'const char* index(const char*, int)'
   61 | index (const char *__s, int __c) __THROW
      | ^~~~~
/usr/include/strings.h:55:1: note:                 'char* index(char*, int)'
   55 | index (char *__s, int __c) __THROW
      | ^~~~~
Baijan.cpp:87:23: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   87 |       ver += 1 << cur - 9;
      |                   ~~~~^~~
Baijan.cpp: At global scope:
Baijan.cpp:8:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
    8 |   void __print() {
      |        ^~~~~~~