제출 #1035997

#제출 시각아이디문제언어결과실행 시간메모리
1035997vjudge1Two Transportations (JOI19_transportations)C++17
컴파일 에러
0 ms0 KiB
#include "Baijan.h" #include <vector> #include<bits/stdc++.h> using namespace std; vector<pair<int,int>> adj[2010]; int dist[2010],N_; vector<int>S_bai,T_bai,D_bai; void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D) { N_=N; for(int i=0;i<B;i++) adj[S[i]].push_back({T[i],D[i]}), adj[T[i]].push_back({S[i],D[i]}); S_bai=S; T_bai=T; D_bai=D; } int fsen; void sendnum(int n,int b){ for(int i=b;i--;) SendB(n>>i&1); } vector<int>bits2; void rdedges(){ int C=bits2.size()-31; for(int i=0;i*31<C;i++){ int U=0,V=0,D=0; for(int j=0;j<11;j++) U=U*2+bits2[i*31+j]; for(int j=11;j<22;j++) V=V*2+bits2[i*31+j]; for(int j=22;j<31;j++) D=D*2+bits2[i*31+j]; adj[U].push_back({V,D}); adj[V].push_back({U,D}); } } void djik(){ priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>pq; memset(dist,7,sizeof dist); dist[0]=0; pq.push({0,0}); while(pq.size()){ auto[d,x]=pq.top(); pq.pop(); if(dist[x]<d)continue; for(auto [v,w]:adj[x]) if(dist[v]>w+d) pq.push({dist[v]=w+d,v}); } for(int i=0;i<N_;i++) sendnum(dist[i],20); } void ReceiveB(bool y) { if(!fsen) { if(y) for(int i=0;i<S_bai.size();i++){ sendnum(S_bai[i],11); sendnum(T_bai[i],11); sendnum(D_bai[i],9); } fsen=1; } else { bits2.push_back(y); if(bits2.size()>=31&&!*max_element(bits2.rbegin(),bits2.rbegin()+31)) rdedges(),djik(); } }

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

Azer.cpp: In function 'void sendnum(int, int)':
Azer.cpp:21:9: error: 'SendB' was not declared in this scope
   21 |         SendB(n>>i&1);
      |         ^~~~~
Azer.cpp: In function 'void ReceiveB(bool)':
Azer.cpp:57:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             for(int i=0;i<S_bai.size();i++){
      |                         ~^~~~~~~~~~~~~

/usr/bin/ld: /tmp/cc5jyDQN.o: in function `main':
grader_baijan.cpp:(.text.startup+0x174): undefined reference to `InitB(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader_baijan.cpp:(.text.startup+0x202): undefined reference to `ReceiveB(bool)'
collect2: error: ld returned 1 exit status