제출 #963473

#제출 시각아이디문제언어결과실행 시간메모리
963473GrindMachineTwo Transportations (JOI19_transportations)C++17
8 / 100
423 ms31752 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long int ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) #define pb push_back #define endl '\n' #define sz(a) (int)a.size() #define setbits(x) __builtin_popcountll(x) #define ff first #define ss second #define conts continue #define ceil2(x,y) ((x+y-1)/(y)) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define yes cout << "Yes" << endl #define no cout << "No" << endl #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) #define rev(i,s,e) for(int i = s; i >= e; --i) #define trav(i,a) for(auto &i : a) template<typename T> void amin(T &a, T b) { a = min(a,b); } template<typename T> void amax(T &a, T b) { a = max(a,b); } #ifdef LOCAL #include "debug.h" #else #define debug(x) 42 #endif /* */ #include "Azer.h" #include <vector> namespace { int n; vector<int> a; vector<vector<pii>> adj; priority_queue< pii, vector<pii>, greater<pii> > pq; vector<bool> vis; vector<int> ans; } // namespace void InitA(int n_, int m, std::vector<int> U, std::vector<int> V, std::vector<int> C) { n = n_; adj.resize(n); rep(i,m) { int u = U[i], v = V[i], w = C[i]; adj[u].pb({v,w}), adj[v].pb({u,w}); } } void ReceiveA(bool x) { a.pb(x); } std::vector<int> Answer() { int B = 0; while((1<<B) <= n) B++; int ptr = 0; while(ptr < sz(a)){ int u = 0, v = 0, w = 0; rep(iter,B){ int b = a[ptr++]; u = u<<1|b; } rep(iter,B){ int b = a[ptr++]; v = v<<1|b; } rep(iter,9){ int b = a[ptr++]; w = w<<1|b; } // cout << u << " " << v << " " << w << endl; adj[u].pb({v,w}), adj[v].pb({u,w}); } vis.resize(n); ans.resize(n); pq.push({0,0}); while(!pq.empty()){ auto [cost,u] = pq.top(); pq.pop(); if(vis[u]) conts; vis[u] = 1; ans[u] = cost; for(auto [v,w] : adj[u]){ pq.push({cost+w,v}); } } return ans; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long int ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) #define pb push_back #define endl '\n' #define sz(a) (int)a.size() #define setbits(x) __builtin_popcountll(x) #define ff first #define ss second #define conts continue #define ceil2(x,y) ((x+y-1)/(y)) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define yes cout << "Yes" << endl #define no cout << "No" << endl #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) #define rev(i,s,e) for(int i = s; i >= e; --i) #define trav(i,a) for(auto &i : a) template<typename T> void amin(T &a, T b) { a = min(a,b); } template<typename T> void amax(T &a, T b) { a = max(a,b); } #ifdef LOCAL #include "debug.h" #else #define debug(x) 42 #endif /* */ #include "Baijan.h" #include <vector> namespace { vector<vector<pii>> adj; priority_queue< array<int,4>, vector<array<int,4>>, greater<array<int,4>> > pq; vector<bool> vis; vector<array<int,3>> sp_tree; vector<array<int,3>> edges; } // namespace void InitB(int n, int m, std::vector<int> S, std::vector<int> T, std::vector<int> D) { adj.resize(n); vis.resize(n); rep(i,m){ int u = S[i], v = T[i], w = D[i]; edges.pb({u,v,w}); } int B = 0; while((1<<B) <= n) B++; for(auto [u,v,w] : edges){ if(u == -1 or v == -1) conts; rep(bit,B){ int f = 1<<(B-bit-1); int b = 0; if(u&f) b = 1; SendB(b); } rep(bit,B){ int f = 1<<(B-bit-1); int b = 0; if(v&f) b = 1; SendB(b); } rep(bit,9){ int f = 1<<(9-bit-1); int b = 0; if(w&f) b = 1; SendB(b); } } } void ReceiveB(bool y) { }
#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...