제출 #428194

#제출 시각아이디문제언어결과실행 시간메모리
428194tengiz05Two Transportations (JOI19_transportations)C++17
컴파일 에러
0 ms0 KiB
#include "Azer.h" #include <bits/stdc++.h> namespace { int N; int count; std::vector<int> a; } // namespace int idx; void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C) { assert(A == 0); ::N = N; count = 0; idx = 0; a.assign(N, 0); } void ReceiveA(bool x) { a[idx] += (1 << (count % 21)) * x; count++; if (count % 21 == 0) idx++; } std::vector<int> Answer() { assert(count == 21 * n); std::vector<int> ans(N); for (int k = 0; k < N; ++k) { ans[k] = a[k]; } return ans; }
#include "Baijan.h" #include <bits/stdc++.h> namespace { int n; int count; } // namespace typedef std::pair<int, int> pii; void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D) { ::n = N; std::vector<std::vector<std::pair<int, int>>> e(n); for (int i = 0; i < B - 1; i++) { e[S[i]].emplace_back(T[i], D[i]); e[T[i]].emplace_back(S[i], D[i]); } std::priority_queue<pii, std::vector<pii>> q; q.emplace(0, 0); std::vector<int> dist(n, 1e9); dist[0] = 0; while (!q.empty()) { auto [d, u] = q.top(); q.pop(); if (d > dist[u]) { continue; } for (auto [v, w] : e[u]) { if (dist[v] > d + w) { dist[v] = d + w; q.emplace(dist[v], v); } } } for (int i = 0; i < n; i++) { assert(dist[i] != (int)1e9); for (int j = 0; j < 21; j++) { SendB((1 << j) & dist[i]); } } count = 0; } void ReceiveB(bool y) { assert(false); }

컴파일 시 표준 에러 (stderr) 메시지

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from Azer.cpp:2:
Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:28:23: error: 'n' was not declared in this scope; did you mean 'yn'?
   28 |  assert(count == 21 * n);
      |                       ^