제출 #780474

#제출 시각아이디문제언어결과실행 시간메모리
780474bachhoangxuanTwo Transportations (JOI19_transportations)C++17
컴파일 에러
0 ms0 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> namespace { const int inf=(1<<20)-1; int N,cnt=0,pu=0,pv=0,cur=0,lst=0; vector<bool> used; vector<int> dist; vector<vector<pii>> edge; void d(int u){ used[u]=true;lst=dist[u]; for(pii v:edge[u]) dist[v.first]=min(dist[v.first],dist[u]+v.second); } void Send(){ int u=-1; for(int i=0;i<N;i++) if(!used[i] && (u==-1 || dist[i]<dist[u])) u=i; if(u==-1) return; int x=min(dist[u]-lst,511);pu=u; for(int i=0;i<9;i++) SendA((x>>i)&1); } } // namespace void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C) { ::N=N; cnt=pu=pv=cur=lst=0; used.resize(N); dist.assign(N,inf); edge.resize(N); for(int i=0;i<A;i++){ edge[U[i]].push_back({V[i],C[i]}); edge[V[i]].push_back({U[i],C[i]}); } dist[0]=0;d(0); Send(); } void ReceiveA(bool x) { if(cnt<9){ if(x) cur|=(1<<cnt); if(++cnt==9){ cur+=lst;            if(dist[pu]<=cur){ for(int i=0;i<11;i++) SendA((pu>>i)&1); d(pu);Send();cnt=cur=0; } else pv=0; } } else{ if(x) pv|=(1<<(cnt-9)); if(++cnt==20){ dist[pv]=min(dist[pv],cur); d(pv);Send(); cnt=cur=0; } } } vector<int> Answer() { return dist; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> namespace { const int inf=(1<<20)-1; int N,cnt=0,pu=0,pv=0,cur=0,lst=0; vector<bool> used; vector<int> dist; vector<vector<pii>> edge; void d(int u){ used[u]=true;lst=dist[u]; for(pii v:edge[u]) dist[v.first]=min(dist[v.first],dist[u]+v.second); } void Send(){ int u=-1; for(int i=0;i<N;i++) if(!used[i] && (u==-1 || dist[i]<dist[u])) u=i; if(u==-1) return; int x=min(dist[u]-lst,511);pu=u; for(int i=0;i<9;i++) SendB((x>>i)&1); } } // namespace void InitB(int N, int B, vector<int> U, vector<int> V, vector<int> C) { ::N=N; cnt=pu=pv=cur=lst=0; used.resize(N); dist.assign(N,inf); edge.resize(N); for(int i=0;i<B;i++){ edge[U[i]].push_back({V[i],C[i]}); edge[V[i]].push_back({U[i],C[i]}); } dist[0]=0;d(0); Send(); } void ReceiveB(bool x) { if(cnt<9){ if(x) cur|=(1<<cnt); if(++cnt==9){ cur+=lst; if(dist[pu]<cur){ for(int i=0;i<11;i++) SendB((pu>>i)&1); d(pu);Send();cnt=cur=0; } else pv=0; } } else{ if(x) pv|=(1<<(cnt-9)); if(++cnt==20){ dist[pv]=min(dist[pv],cur); d(pv);Send(); cnt=cur=0; } } }

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

Azer.cpp:44:2: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |  ^
Azer.cpp:44:5: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |    ^
Azer.cpp:44:8: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |      ^
Azer.cpp:44:11: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |        ^
Azer.cpp:44:14: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |          ^
Azer.cpp:44:17: error: extended character   is not valid in an identifier
   44 |             if(dist[pu]<=cur){
      |            ^
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:44:2: error: '\U000000a0' was not declared in this scope
   44 |             if(dist[pu]<=cur){
      |  ^
Azer.cpp:48:13: error: expected '}' before 'else'
   48 |             else pv=0;
      |             ^~~~
Azer.cpp:42:21: note: to match this '{'
   42 |         if(++cnt==9){
      |                     ^
Azer.cpp: At global scope:
Azer.cpp:51:5: error: expected unqualified-id before 'else'
   51 |     else{
      |     ^~~~
Azer.cpp:59:1: error: expected declaration before '}' token
   59 | }
      | ^