제출 #1058818

#제출 시각아이디문제언어결과실행 시간메모리
1058818Jarif_RahmanTwo Transportations (JOI19_transportations)C++17
0 / 100
12 ms804 KiB
#include "Azer.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; namespace { const int inf = 1e8; vector<int> dijkstra(const vector<vector<pair<int, int>>> &graph, int source){ int n = graph.size(); vector<int> dis(n, inf); vector<bool> bl(n, 0); priority_queue<pair<ll, int>> pq; dis[source] = 0; pq.push({0, source}); while(!pq.empty()){ int nd = pq.top().second; pq.pop(); if(bl[nd]) continue; bl[nd] = 1; for(auto [x, w]: graph[nd]) if(dis[nd]+w < dis[x]){ dis[x] = dis[nd]+w; pq.push({-dis[x], x}); } } return dis; } vector<bool> itob(int x, int sz){ vector<bool> rt; for(int i = 0; i < sz; i++){ rt.push_back(x%2 == 1); x/=2; } return rt; } int btoi(vector<bool> x){ int rt = 0; reverse(x.begin(), x.end()); for(bool b: x) rt*=2, rt+=b; return rt; } int n; vector<vector<pair<int, int>>> graph; int target = 19; int m = -1; vector<bool> b; vector<int> ans; } void InitA(int _n, int A, vector<int> U, vector<int> V, vector<int> C){ n = _n; graph.resize(n); for(int i = 0; i < A; i++){ graph[U[i]].push_back({V[i], C[i]}); graph[V[i]].push_back({U[i], C[i]}); } } void ReceiveA(bool x){ target--; b.push_back(x); if(target) return; if(m == -1){ m = btoi(b); b.clear(); target=m*31; return; } reverse(b.begin(), b.end()); vector<bool> b2; for(int i = 0; i < m; i++){ for(int j = 0; j < 11; j++) b2.push_back(b.back()), b.pop_back(); int u = btoi(b2); b2.clear(); for(int j = 0; j < 11; j++) b2.push_back(b.back()), b.pop_back(); int v = btoi(b2); b2.clear(); for(int j = 0; j < 9; j++) b2.push_back(b.back()), b.pop_back(); int w = btoi(b2); b2.clear(); graph[u].push_back({v, w}); graph[v].push_back({u, w}); } ans = dijkstra(graph, 0); } vector<int> Answer(){ return ans; }
#include "Baijan.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; namespace { const int inf = 1e8; vector<int> dijkstra(const vector<vector<pair<int, int>>> &graph, int source){ int n = graph.size(); vector<int> dis(n, inf); vector<bool> bl(n, 0); priority_queue<pair<ll, int>> pq; dis[source] = 0; pq.push({0, source}); while(!pq.empty()){ int nd = pq.top().second; pq.pop(); if(bl[nd]) continue; bl[nd] = 1; for(auto [x, w]: graph[nd]) if(dis[nd]+w < dis[x]){ dis[x] = dis[nd]+w; pq.push({-dis[x], x}); } } return dis; } vector<bool> itob(int x, int sz){ vector<bool> rt; for(int i = 0; i < sz; i++){ rt.push_back(x%2 == 1); x/=2; } return rt; } int btoi(vector<bool> x){ int rt = 0; reverse(x.begin(), x.end()); for(bool b: x) rt*=2, rt+=b; return rt; } int n; vector<vector<pair<int, int>>> graph; } void InitB(int _n, int B, vector<int> S, vector<int> T, vector<int> D){ n = _n; graph.resize(n); for(int i = 0; i < B; i++){ graph[S[i]].push_back({T[i], D[i]}); graph[T[i]].push_back({S[i], D[i]}); } vector<int> dis = dijkstra(graph, 0); vector<tuple<int, int, int>> e; for(int i = 0; i < B; i++){ if(dis[S[i]] == dis[T[i]]+D[i] || dis[T[i]] == dis[S[i]]+D[i]) e.push_back({S[i], T[i], D[i]}); } vector<bool> sn = itob(e.size(), 19); for(bool b: sn) SendB(b); for(auto [u, v, w]: e){ sn = itob(u, 11); for(bool b: sn) SendB(b); sn = itob(v, 11); for(bool b: sn) SendB(b); sn = itob(u, 9); for(bool b: sn) SendB(b); } } void ReceiveB(bool x){ }

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

Azer.cpp:35:14: warning: 'std::vector<bool> {anonymous}::itob(int, int)' defined but not used [-Wunused-function]
   35 | vector<bool> itob(int x, int sz){
      |              ^~~~

Baijan.cpp:43:5: warning: 'int {anonymous}::btoi(std::vector<bool>)' defined but not used [-Wunused-function]
   43 | int btoi(vector<bool> x){
      |     ^~~~
#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...