제출 #1066378

#제출 시각아이디문제언어결과실행 시간메모리
1066378urd05Two Transportations (JOI19_transportations)C++17
컴파일 에러
0 ms0 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; namespace A { int n; int ca=0; bool vis[2005]; vector<P> adj[2005]; priority_queue<P,vector<P>,greater<P>> pq; int nowd=0; int got=0; int prd=0; int cnt=0; int dist[2005]; const int INF=1e6; } // namespace typedef pair<int,int> P; void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C) { A::n=N; for(int i=0;i<A;i++) { A::adj[U[i]].push_back(P(V[i],C[i])); A::adj[V[i]].push_back(P(U[i],C[i])); } A::dist[0]=0; for(int i=1;i<A::n;i++) { A::dist[i]=A::INF; A::pq.push(P(A::dist[i],i)); } A::pq.push(P(0,0)); A::nowd=0; SendA(0); } void ReceiveA(bool x) { //printf(".%d %d\n",A::ca,x); if (A::ca==8) { if (x) { A::got+=(1<<(A::ca)); } A::cnt++; if (A::nowd<=A::got) { int now=A::pq.top().second; for(int i=0;i<11;i++) { if (now&(1<<i)) { SendA(1); } else { SendA(0); } } if (A::cnt==A::n) { return; } A::ca=0; A::pq.pop(); A::vis[now]=true; for(int i=0;i<A::adj[now].size();i++) { int nt=A::adj[now][i].first; int d=A::adj[now][i].second; if (A::dist[nt]>A::dist[now]+d) { A::dist[nt]=A::dist[now]+d; A::pq.push(P(A::dist[nt],nt)); } } A::prd=A::dist[now]; while (1) { now=A::pq.top().second; if (!A::vis[now]) { break; } A::pq.pop(); } A::nowd=A::pq.top().first-A::prd; //printf("! %d %d\n",A::nowd,now); if (A::nowd<=511) SendA(A::nowd&1); else SendA(1); A::ca=0; A::got=0; } else { A::ca++; A::nowd=A::got; A::got=0; } } else if (A::ca<8) { if (x) { A::got+=(1<<(A::ca)); } A::ca++; if (A::nowd>511||(A::nowd&(1<<A::ca))) { SendA(1); } else { SendA(0); } } else if (A::ca>8) { if (x) { A::got+=(1<<(A::ca-9)); } if (A::ca==19) { A::dist[A::got]=A::nowd+A::prd; int now=A::got; A::vis[now]=true; for(int i=0;i<A::adj[now].size();i++) { int nt=A::adj[now][i].first; int d=A::adj[now][i].second; if (A::dist[nt]>A::dist[now]+d) { A::dist[nt]=A::dist[now]+d; A::pq.push(P(A::dist[nt],nt)); } } A::prd=A::dist[now]; while (!A::pq.empty()) { now=A::pq.top().second; if (!A::vis[now]) { break; } A::pq.pop(); } //printf("! %d\n",A::cnt); if (A::cnt==A::n) { return; } A::nowd=A::pq.top().first-A::prd; //printf(".! %d %d\n",A::nowd,now); if (A::nowd<=511) { SendA(A::nowd&1); } else { SendA(1); } A::ca=0; A::got=0; } else { A::ca++; } } } std::vector<int> Answer() { std::vector<int> ans(A::n); for (int k = 0; k < A::n; ++k) { ans[k] = A::dist[k]; } return ans; }
#include "Baijan.h" #include <vector> namespace B { int n; int ca=0; bool vis[2005]; vector<P> adj[2005]; priority_queue<P,vector<P>,greater<P>> pq; int nowd=0; int got=0; int prd=0; int cnt=0; int dist[2005]; const int INF=1e6; } // namespace void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D) { B::n=N; for(int i=0;i<B;i++) { B::adj[S[i]].push_back(P(T[i],D[i])); B::adj[T[i]].push_back(P(S[i],D[i])); } B::dist[0]=0; for(int i=1;i<B::n;i++) { B::dist[i]=B::INF; B::pq.push(P(B::dist[i],i)); } B::pq.push(P(0,0)); B::nowd=0; } void ReceiveB(bool y) { //printf("..%d %d\n",B::ca,y); if (B::ca==8) { if (y) { B::got+=(1<<(B::ca)); } if (B::nowd>511||(B::nowd&(1<<B::ca))) { SendB(1); } else { SendB(0); } B::cnt++; if (B::nowd<B::got) { int now=B::pq.top().second; for(int i=0;i<11;i++) { if (now&(1<<i)) { SendB(1); } else { SendB(0); } } if (B::cnt==B::n) { return; } B::ca=0; B::pq.pop(); B::vis[now]=true; for(int i=0;i<B::adj[now].size();i++) { int nt=B::adj[now][i].first; int d=B::adj[now][i].second; if (B::dist[nt]>B::dist[now]+d) { B::dist[nt]=B::dist[now]+d; B::pq.push(P(B::dist[nt],nt)); } } B::prd=B::dist[now]; while (1) { now=B::pq.top().second; if (!B::vis[now]) { break; } B::pq.pop(); } B::nowd=B::pq.top().first-B::prd; //printf("!! %d %d\n",B::nowd,now); B::ca=0; B::got=0; } else { B::ca++; B::nowd=B::got; B::got=0; } } else if (B::ca<8) { if (y) { B::got+=(1<<(B::ca)); } if (B::nowd>511||(B::nowd&(1<<B::ca))) { SendB(1); } else { SendB(0); } B::ca++; } else if (B::ca>8) { if (y) { B::got+=(1<<(B::ca-9)); } if (B::ca==19) { B::dist[B::got]=B::nowd+B::prd; int now=B::got; B::vis[now]=true; for(int i=0;i<B::adj[now].size();i++) { int nt=B::adj[now][i].first; int d=B::adj[now][i].second; if (B::dist[nt]>B::dist[now]+d) { B::dist[nt]=B::dist[now]+d; B::pq.push(P(B::dist[nt],nt)); } } //printf(".%d\n",now); B::prd=B::dist[now]; while (!B::pq.empty()) { now=B::pq.top().second; if (!B::vis[now]) { break; } B::pq.pop(); } if (B::cnt==B::n) { return; } B::nowd=B::pq.top().first-B::prd; //printf(".!! %d %d\n",B::nowd,now); B::ca=0; B::got=0; } else { B::ca++; } } }

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

Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:65:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |             for(int i=0;i<A::adj[now].size();i++) {
      |                         ~^~~~~~~~~~~~~~~~~~~
Azer.cpp:116:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  116 |             for(int i=0;i<A::adj[now].size();i++) {
      |                         ~^~~~~~~~~~~~~~~~~~~

Baijan.cpp:9:1: error: 'vector' does not name a type
    9 | vector<P> adj[2005];
      | ^~~~~~
Baijan.cpp:10:1: error: 'priority_queue' does not name a type
   10 | priority_queue<P,vector<P>,greater<P>> pq;
      | ^~~~~~~~~~~~~~
Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:24:12: error: 'adj' is not a member of 'B'
   24 |         B::adj[S[i]].push_back(P(T[i],D[i]));
      |            ^~~
Baijan.cpp:24:32: error: 'P' was not declared in this scope
   24 |         B::adj[S[i]].push_back(P(T[i],D[i]));
      |                                ^
Baijan.cpp:25:12: error: 'adj' is not a member of 'B'
   25 |         B::adj[T[i]].push_back(P(S[i],D[i]));
      |            ^~~
Baijan.cpp:30:4: error: 'pq' is not a member of 'B'
   30 | B::pq.push(P(B::dist[i],i));
      |    ^~
Baijan.cpp:30:12: error: 'P' was not declared in this scope
   30 | B::pq.push(P(B::dist[i],i));
      |            ^
Baijan.cpp:32:8: error: 'pq' is not a member of 'B'
   32 |     B::pq.push(P(0,0));
      |        ^~
Baijan.cpp:32:16: error: 'P' was not declared in this scope
   32 |     B::pq.push(P(0,0));
      |                ^
Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:50:24: error: 'pq' is not a member of 'B'
   50 |             int now=B::pq.top().second;
      |                        ^~
Baijan.cpp:63:16: error: 'pq' is not a member of 'B'
   63 |             B::pq.pop();
      |                ^~
Baijan.cpp:65:30: error: 'adj' is not a member of 'B'
   65 |             for(int i=0;i<B::adj[now].size();i++) {
      |                              ^~~
Baijan.cpp:66:27: error: 'adj' is not a member of 'B'
   66 |                 int nt=B::adj[now][i].first;
      |                           ^~~
Baijan.cpp:67:26: error: 'adj' is not a member of 'B'
   67 |                 int d=B::adj[now][i].second;
      |                          ^~~
Baijan.cpp:70:24: error: 'pq' is not a member of 'B'
   70 |                     B::pq.push(P(B::dist[nt],nt));
      |                        ^~
Baijan.cpp:70:32: error: 'P' was not declared in this scope
   70 |                     B::pq.push(P(B::dist[nt],nt));
      |                                ^
Baijan.cpp:75:24: error: 'pq' is not a member of 'B'
   75 |                 now=B::pq.top().second;
      |                        ^~
Baijan.cpp:79:20: error: 'pq' is not a member of 'B'
   79 |                 B::pq.pop();
      |                    ^~
Baijan.cpp:81:24: error: 'pq' is not a member of 'B'
   81 |             B::nowd=B::pq.top().first-B::prd;
      |                        ^~
Baijan.cpp:112:30: error: 'adj' is not a member of 'B'
  112 |             for(int i=0;i<B::adj[now].size();i++) {
      |                              ^~~
Baijan.cpp:113:27: error: 'adj' is not a member of 'B'
  113 |                 int nt=B::adj[now][i].first;
      |                           ^~~
Baijan.cpp:114:26: error: 'adj' is not a member of 'B'
  114 |                 int d=B::adj[now][i].second;
      |                          ^~~
Baijan.cpp:117:24: error: 'pq' is not a member of 'B'
  117 |                     B::pq.push(P(B::dist[nt],nt));
      |                        ^~
Baijan.cpp:117:32: error: 'P' was not declared in this scope
  117 |                     B::pq.push(P(B::dist[nt],nt));
      |                                ^
Baijan.cpp:122:24: error: 'pq' is not a member of 'B'
  122 |             while (!B::pq.empty()) {
      |                        ^~
Baijan.cpp:123:24: error: 'pq' is not a member of 'B'
  123 |                 now=B::pq.top().second;
      |                        ^~
Baijan.cpp:127:20: error: 'pq' is not a member of 'B'
  127 |                 B::pq.pop();
      |                    ^~
Baijan.cpp:132:24: error: 'pq' is not a member of 'B'
  132 |             B::nowd=B::pq.top().first-B::prd;
      |                        ^~