제출 #134852

#제출 시각아이디문제언어결과실행 시간메모리
134852scanhexTwo Transportations (JOI19_transportations)C++17
0 / 100
8 ms1904 KiB
#include<bits/stdc++.h> using namespace std; #include "Azer.h" namespace { const int N=2020; vector<pair<int,int>>g[N]; deque<int>q; void send(int x,int len){ for(int i=len-1;i>=0;--i) SendA(x>>i&1); } int receive(int len){ assert(q.size()>=len); int ans=0; for(int i=0;i<len;++i) ans*=2,ans+=q.front(),q.pop_front(); return ans; } int d[N]; int n; const int oo=0x3f3f3f3f; int state=0; int rest=0; int kek,mem; auto cmp=[&](const int a,const int b){ if(d[a]!=d[b]) return d[a]<d[b]; return a<b; }; set<int,decltype(cmp)>st(cmp); void relax(){ // cerr<<"a "<<kek<<' '<<mem<<'\n'; st.erase(kek); d[kek]=mem; for(auto& [a,b]:g[kek]){ if(d[kek]+b<d[a]){ st.erase(a); d[a]=d[kek]+b; st.insert(a); } } } void proc(){ int num=0; for(int x:q)num*=2,num+=x; q.clear(); if(!st.size())return; if(state==0){ kek=*st.begin(); mem=d[kek]; // cerr<<"a "<<mem<<'\n'; send(mem,9); state=1; rest=1; return; } if(state==1){ if(num==1){ send(kek,11); relax(); state=0; proc(); return; } else{ state=2; rest=9; return; } } if(state==2){ mem=num; state=3; rest=11; return; } if(state==3){ kek=num; relax(); state=0; proc(); return; } } } // namespace void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C) { n=N; for(int i=0;i<A;++i){ g[U[i]].emplace_back(V[i],C[i]); g[V[i]].emplace_back(U[i],C[i]); } fill(d,d+n,oo); d[0]=0; st.insert(0); proc(); } void ReceiveA(bool x) { q.push_back(x); if(--rest==0){ proc(); } } std::vector<int> Answer() { vector<int>ans(d,d+n); return ans; }
#include<bits/stdc++.h> using namespace std; #include "Baijan.h" namespace { const int N=2020; vector<pair<int,int>>g[N]; deque<int>q; void send(int x,int len){ for(int i=len-1;i>=0;--i) SendB(x>>i&1); } int receive(int len){ assert(q.size()>=len); int ans=0; for(int i=0;i<len;++i) ans*=2,ans+=q.front(),q.pop_front(); return ans; } int d[N]; int n; const int oo=0x3f3f3f3f; int rest=0; int state=0; int kek,mem; auto cmp=[&](const int a,const int b){ if(d[a]!=d[b]) return d[a]<d[b]; return a<b; }; set<int,decltype(cmp)>st(cmp); void relax(){ // cerr<<kek<<' '<<mem<<'\n'; st.erase(kek); d[kek]=mem; for(auto& [a,b]:g[kek]){ if(d[kek]+b<d[a]){ st.erase(a); d[a]=d[kek]+b; st.insert(a); } } } void proc(){ int num=0; for(int x:q)num*=2,num+=x; q.clear(); if(!st.size())return; if(state==0){ kek=*st.begin(); mem=d[kek]; int di=num; // cerr<<di<<'\n'; if(mem>=di){ send(1,1); mem=di; state=1; rest=11; return; } else{ // cerr<<"rofl\n"; send(0,1); send(mem,9); send(kek,11); state=0; rest=9; relax(); return; } } if(state==1){ kek=num; relax(); state=0; rest=9; return; } } } // namespace void InitB(int N, int B, std::vector<int> U, std::vector<int> V, std::vector<int> C) { n=N; for(int i=0;i<B;++i){ g[U[i]].emplace_back(V[i],C[i]); g[V[i]].emplace_back(U[i],C[i]); } fill(d,d+n,oo); d[0]=0; st.insert(0); rest=9; } void ReceiveB(bool y) { q.push_back(y); if(--rest==0)proc(); }

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

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from Azer.cpp:1:
Azer.cpp: In function 'int {anonymous}::receive(int)':
Azer.cpp:14:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(q.size()>=len);
         ~~~~~~~~^~~
Azer.cpp: At global scope:
Azer.cpp:13:5: warning: 'int {anonymous}::receive(int)' defined but not used [-Wunused-function]
 int receive(int len){
     ^~~~~~~

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from Baijan.cpp:1:
Baijan.cpp: In function 'int {anonymous}::receive(int)':
Baijan.cpp:14:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(q.size()>=len);
         ~~~~~~~~^~~
Baijan.cpp: At global scope:
Baijan.cpp:13:5: warning: 'int {anonymous}::receive(int)' defined but not used [-Wunused-function]
 int receive(int len){
     ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...