Submission #781784

#TimeUsernameProblemLanguageResultExecution timeMemory
781784Dan4LifeTwo Transportations (JOI19_transportations)C++17
6 / 100
311 ms10224 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; using ar = array<int,2>; using vi = vector<int>; #define pb push_back namespace { const int mxN = (int)2e3+10; int n,cnt,dis[mxN]; vector<ar> adj[mxN]; void dijkstra(){ priority_queue<ar,vector<ar>,greater<ar>> pq; memset(dis,63,sizeof(dis)); pq.push({0,0}); dis[0]=0; while(!pq.empty()){ auto [D,a] = pq.top(); pq.pop(); if(D!=dis[a]) continue; for(auto [b,w] : adj[a]) if(dis[b]>dis[a]+w) dis[b]=dis[a]+w,pq.push({dis[b],b}); } } void Send(int x){ for(int i = 0; i < 8; i++) SendA((x>>i)&1); } } void InitA(int N, int A, vi U, vi V, vi C) { n = N; fill(dis,dis+mxN,0); for (int i = 0; i < A; ++i) { adj[U[i]].pb({V[i],C[i]}); adj[V[i]].pb({U[i],C[i]}); } } int tot = 1, cur = 0; void ReceiveA(bool x) { dis[tot]|=(1<<cur)*x; cur++; if(cur>=20) cur=0,tot++; } vi Answer() { vi ans(n,0); for(int k = 1; k < n; ++k) ans[k] = dis[k]; return ans; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; using ar = array<int,2>; using vi = vector<int>; #define pb push_back namespace { const int mxN = (int)2e3+10; int n,cnt,dis[mxN]; vector<ar> adj[mxN]; void dijkstra(){ priority_queue<ar,vector<ar>,greater<ar>> pq; memset(dis,63,sizeof(dis)); pq.push({0,0}); dis[0]=0; while(!pq.empty()){ auto [D,a] = pq.top(); pq.pop(); if(D!=dis[a]) continue; for(auto [b,w] : adj[a]) if(dis[b]>dis[a]+w) dis[b]=dis[a]+w,pq.push({dis[b],b}); } } void Send(int x){ for(int i = 0; i < 20; i++) SendB((x>>i)&1); } } void InitB(int N, int B, vi U, vi V, vi C) { n = N; fill(dis,dis+mxN,0); for (int i = 0; i < B; ++i) { adj[U[i]].pb({V[i],C[i]}); adj[V[i]].pb({U[i],C[i]}); } dijkstra(); for(int i = 1; i < n; i++) Send(dis[i]); } void ReceiveB(bool y) { }

Compilation message (stderr)

Azer.cpp:24:7: warning: 'void {anonymous}::Send(int)' defined but not used [-Wunused-function]
   24 |  void Send(int x){
      |       ^~~~
Azer.cpp:12:7: warning: 'void {anonymous}::dijkstra()' defined but not used [-Wunused-function]
   12 |  void dijkstra(){
      |       ^~~~~~~~
Azer.cpp:10:8: warning: '{anonymous}::cnt' defined but not used [-Wunused-variable]
   10 |  int n,cnt,dis[mxN];
      |        ^~~

Baijan.cpp:10:8: warning: '{anonymous}::cnt' defined but not used [-Wunused-variable]
   10 |  int n,cnt,dis[mxN];
      |        ^~~
#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...