제출 #788176

#제출 시각아이디문제언어결과실행 시간메모리
788176someoneTwo Transportations (JOI19_transportations)C++14
컴파일 에러
0 ms0 KiB
#include "Azer.h" struct Arc { int nex, pds; }; const int N = 2e3 + 42, INF = 1e6 + 42; bool sent[N]; int n, knows[N]; vector<bool> msg; vector<int> dist; vector<Arc> arc[N]; priority_queue<pair<int, int>> pq; void InitA(int X, int a, vector<int> U, vector<int> V, vector<int> C) { n = X; dist.resize(n); for(int i = 0; i < a; i++) { arc[U[i]].push_back({V[i], C[i]}); arc[V[i]].push_back({U[i], C[i]}); } for(int i = 1; i < n; i++) knows[i] = dist[i] = INF; for(int i = 0; i < n; i++) pq.push({-dist[i], i}); bool envoi = false; while(!envoi && !pq.empty()) { int i = pq.top().second, d = -pq.top().first; pq.pop(); if(dist[i] == d) { for(Arc a : arc[i]) { if(dist[a.nex] > dist[i] + a.pds) { dist[a.nex] = dist[i] + a.pds; pq.push({-dist[a.nex], a.nex}); } } if(!sent[i]) { //cout << "Azer envoie " << i << ' ' << d << '\n'; sent[i] = true; envoi = true; for(int j = 0; j < 11; j++) SendA(i & (1 << j)); for(int j = 0; j < 20; j++) SendA(d & (1 << j)); } } } } void ReceiveA(bool x) { msg.push_back(x); if(31 == (int)msg.size()) { int i = 0, d = 0; for(int j = 0; j < 11; j++) i += (1 << j) * msg[j]; for(int j = 0; j < 20; j++) d += (1 << j) * msg[j + 11]; msg.clear(); dist[i] = min(dist[i], d); pq.push({-dist[i], i}); knows[i] = d; bool envoi = false; while(!envoi && !pq.empty()) { i = pq.top().second, d = -pq.top().first; pq.pop(); if(dist[i] == d) { for(Arc a : arc[i]) { if(dist[a.nex] > dist[i] + a.pds) { dist[a.nex] = dist[i] + a.pds; pq.push({-dist[a.nex], a.nex}); } } if(!sent[i] && knows[i] > d) { //cout << "Azer envoie " << i << ' ' << d << '\n'; knows[i] = d; sent[i] = true; envoi = true; for(int j = 0; j < 11; j++) SendA(i & (1 << j)); for(int j = 0; j < 20; j++) SendA(d & (1 << j)); } } } if(!envoi) for(int j = 0; j < n; j++) if(dist[j] == INF) { for(int k = 0; k < 11; k++) SendA(j & (1 << k)); for(int k = 0; k < 20; k++) SendA(INF & (1 << k)); } } } vector<int> Answer() { return dist; }
#include "Baijan.h" struct Arc { int nex, pds; }; const int N = 2e3 + 42, INF = 1e6 + 42; bool sent[N]; int n, knows[N]; vector<int> dist; vector<Arc> arc[N]; vector<bool> msg; priority_queue<pair<int, int>> pq; void InitB(int X, int b, vector<int> S, vector<int> T, vector<int> D) { n = X; dist.resize(n); for(int i = 0; i < b; i++) { arc[S[i]].push_back({T[i], D[i]}); arc[T[i]].push_back({S[i], D[i]}); } for(int i = 1; i < n; i++) knows[i] = dist[i] = INF; for(int i = 0; i < n; i++) pq.push({-dist[i], i}); } void ReceiveB(bool y) { msg.push_back(y); if(31 == (int)msg.size()) { int i = 0, d = 0; for(int j = 0; j < 11; j++) i += (1 << j) * msg[j]; for(int j = 0; j < 20; j++) d += (1 << j) * msg[j + 11]; msg.clear(); dist[i] = min(dist[i], d); pq.push({-dist[i], i}); knows[i] = d; bool envoi = false; while(!envoi && !pq.empty()) { i = pq.top().second, d = -pq.top().first; pq.pop(); if(dist[i] == d) { for(Arc a : arc[i]) { if(dist[a.nex] > dist[i] + a.pds) { dist[a.nex] = dist[i] + a.pds; pq.push({-dist[a.nex], a.nex}); } } if(!sent[i] && knows[i] > d) { knows[i] = d; //cout << "Baijan envoie " << i << ' ' << d << '\n'; sent[i] = true; envoi = true; for(int j = 0; j < 11; j++) SendB(i & (1 << j)); for(int j = 0; j < 20; j++) SendB(d & (1 << j)); } } } if(!envoi) for(int j = 0; j < n; j++) if(dist[j] == INF) { for(int k = 0; k < 11; k++) SendB(j & (1 << k)); for(int k = 0; k < 20; k++) SendB(INF & (1 << k)); } } }

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

Azer.cpp:11:1: error: 'vector' does not name a type
   11 | vector<bool> msg;
      | ^~~~~~
Azer.cpp:12:1: error: 'vector' does not name a type
   12 | vector<int> dist;
      | ^~~~~~
Azer.cpp:13:1: error: 'vector' does not name a type
   13 | vector<Arc> arc[N];
      | ^~~~~~
Azer.cpp:14:1: error: 'priority_queue' does not name a type
   14 | priority_queue<pair<int, int>> pq;
      | ^~~~~~~~~~~~~~
Azer.cpp:16:26: error: 'vector' has not been declared
   16 | void InitA(int X, int a, vector<int> U, vector<int> V, vector<int> C) {
      |                          ^~~~~~
Azer.cpp:16:32: error: expected ',' or '...' before '<' token
   16 | void InitA(int X, int a, vector<int> U, vector<int> V, vector<int> C) {
      |                                ^
Azer.cpp: In function 'void InitA(int, int, int)':
Azer.cpp:18:5: error: 'dist' was not declared in this scope
   18 |     dist.resize(n);
      |     ^~~~
Azer.cpp:20:9: error: 'arc' was not declared in this scope; did you mean 'Arc'?
   20 |         arc[U[i]].push_back({V[i], C[i]});
      |         ^~~
      |         Arc
Azer.cpp:20:13: error: 'U' was not declared in this scope
   20 |         arc[U[i]].push_back({V[i], C[i]});
      |             ^
Azer.cpp:20:30: error: 'V' was not declared in this scope
   20 |         arc[U[i]].push_back({V[i], C[i]});
      |                              ^
Azer.cpp:20:36: error: 'C' was not declared in this scope
   20 |         arc[U[i]].push_back({V[i], C[i]});
      |                                    ^
Azer.cpp:26:9: error: 'pq' was not declared in this scope
   26 |         pq.push({-dist[i], i});
      |         ^~
Azer.cpp:29:22: error: 'pq' was not declared in this scope
   29 |     while(!envoi && !pq.empty()) {
      |                      ^~
Azer.cpp:33:23: error: 'd' was not declared in this scope
   33 |         if(dist[i] == d) {
      |                       ^
Azer.cpp:34:25: error: 'arc' was not declared in this scope; did you mean 'Arc'?
   34 |             for(Arc a : arc[i]) {
      |                         ^~~
      |                         Arc
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:54:5: error: 'msg' was not declared in this scope
   54 |     msg.push_back(x);
      |     ^~~
Azer.cpp:63:9: error: 'dist' was not declared in this scope
   63 |         dist[i] = min(dist[i], d);
      |         ^~~~
Azer.cpp:63:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   63 |         dist[i] = min(dist[i], d);
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/vector:60,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: 'std::min' declared here
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Azer.cpp:64:9: error: 'pq' was not declared in this scope
   64 |         pq.push({-dist[i], i});
      |         ^~
Azer.cpp:73:29: error: 'arc' was not declared in this scope; did you mean 'Arc'?
   73 |                 for(Arc a : arc[i]) {
      |                             ^~~
      |                             Arc
Azer.cpp: At global scope:
Azer.cpp:102:1: error: 'vector' does not name a type
  102 | vector<int> Answer() {
      | ^~~~~~

Baijan.cpp:11:1: error: 'vector' does not name a type
   11 | vector<int> dist;
      | ^~~~~~
Baijan.cpp:12:1: error: 'vector' does not name a type
   12 | vector<Arc> arc[N];
      | ^~~~~~
Baijan.cpp:13:1: error: 'vector' does not name a type
   13 | vector<bool> msg;
      | ^~~~~~
Baijan.cpp:14:1: error: 'priority_queue' does not name a type
   14 | priority_queue<pair<int, int>> pq;
      | ^~~~~~~~~~~~~~
Baijan.cpp:16:26: error: 'vector' has not been declared
   16 | void InitB(int X, int b, vector<int> S, vector<int> T, vector<int> D) {
      |                          ^~~~~~
Baijan.cpp:16:32: error: expected ',' or '...' before '<' token
   16 | void InitB(int X, int b, vector<int> S, vector<int> T, vector<int> D) {
      |                                ^
Baijan.cpp: In function 'void InitB(int, int, int)':
Baijan.cpp:18:5: error: 'dist' was not declared in this scope
   18 |     dist.resize(n);
      |     ^~~~
Baijan.cpp:20:9: error: 'arc' was not declared in this scope; did you mean 'Arc'?
   20 |         arc[S[i]].push_back({T[i], D[i]});
      |         ^~~
      |         Arc
Baijan.cpp:20:13: error: 'S' was not declared in this scope
   20 |         arc[S[i]].push_back({T[i], D[i]});
      |             ^
Baijan.cpp:20:30: error: 'T' was not declared in this scope
   20 |         arc[S[i]].push_back({T[i], D[i]});
      |                              ^
Baijan.cpp:20:36: error: 'D' was not declared in this scope
   20 |         arc[S[i]].push_back({T[i], D[i]});
      |                                    ^
Baijan.cpp:26:9: error: 'pq' was not declared in this scope
   26 |         pq.push({-dist[i], i});
      |         ^~
Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:30:5: error: 'msg' was not declared in this scope
   30 |     msg.push_back(y);
      |     ^~~
Baijan.cpp:39:9: error: 'dist' was not declared in this scope
   39 |         dist[i] = min(dist[i], d);
      |         ^~~~
Baijan.cpp:39:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   39 |         dist[i] = min(dist[i], d);
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/vector:60,
                 from Baijan.h:7,
                 from Baijan.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: 'std::min' declared here
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Baijan.cpp:40:9: error: 'pq' was not declared in this scope
   40 |         pq.push({-dist[i], i});
      |         ^~
Baijan.cpp:49:29: error: 'arc' was not declared in this scope; did you mean 'Arc'?
   49 |                 for(Arc a : arc[i]) {
      |                             ^~~
      |                             Arc