#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 time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
476 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
664 KB |
Output is correct |
2 |
Correct |
148 ms |
1572 KB |
Output is correct |
3 |
Correct |
151 ms |
1460 KB |
Output is correct |
4 |
Correct |
369 ms |
27676 KB |
Output is correct |
5 |
Correct |
275 ms |
29200 KB |
Output is correct |
6 |
Correct |
140 ms |
1616 KB |
Output is correct |
7 |
Correct |
423 ms |
31752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
2268 KB |
Output is correct |
2 |
Correct |
0 ms |
664 KB |
Output is correct |
3 |
Runtime error |
0 ms |
476 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
1360 KB |
Output is correct |
2 |
Correct |
130 ms |
1768 KB |
Output is correct |
3 |
Runtime error |
34 ms |
6848 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
1360 KB |
Output is correct |
2 |
Correct |
130 ms |
1768 KB |
Output is correct |
3 |
Runtime error |
34 ms |
6848 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
1360 KB |
Output is correct |
2 |
Correct |
130 ms |
1768 KB |
Output is correct |
3 |
Runtime error |
34 ms |
6848 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
476 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |