QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420223 | #67. Two Transportations | Bronya | 0 | 10ms | 3952kb | C++20 | 3.0kb | 2024-05-24 15:32:42 | 2024-05-24 15:32:43 |
Judging History
Azer
#include<bits/stdc++.h>
#include "Azer.h"
using namespace std;
struct edge{
int obj;
int last;
int val;
}e[1000006];
int head[2005],g;
vector<int>dist;
void link(int u,int v,int w){
e[++g].obj=v;
e[g].last=head[u];
e[g].val=w;
head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
while(!q.empty()&&pd[q.top().second])q.pop();
if(!q.empty()){
int x=q.top().second;
return {dist[x]-last,x};
}
return {511,0};
}
void update(int u){
pd[u]=true;last=dist[u];
for(int i=head[u];i;i=e[i].last){
int v=e[i].obj,w=e[i].val;
if(dist[v]>dist[u]+w){
dist[v]=dist[u]+w;
q.push({-dist[v],v});
}
}
}
void Init(int x,int len){
for(int i=len-1;i>=0;i--)SendA(x&(1<<i));
}
void InitA(int N,int M,vector<int>U,vector<int>V,vector<int>W){
g=0;
for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
dist.resize(N);
for(int i=1;i<N;i++)dist[i]=1e9;
for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
while(!q.empty())q.pop();
q.push({0,0});
rev=9;op=0;rec=0;update(0);
auto [len,u]=check();Init(len,9);
}
void ReceiveA(bool x){
rec=(rec<<1)|(int)(x);rev--;
if(!rev){
auto [len,u]=check();
if(!op){
if(len<=rec){
op=0,rev=9;rec=0;
update(u);
Init(u,11);Init(check().first,9);
}
else sav=rec,op=1,rev=11,rec=0;
}
else {
dist[rec]=sav+last;
update(rec);
op=0;rev=9;rec=0;
Init(check().first,9);
}
}
}
vector<int> Answer(){
return dist;
}
Baijan
#include<bits/stdc++.h>
#include "Baijan.h"
using namespace std;
struct edge{
int obj;
int last;
int val;
}e[1000006];
int head[2005],g;
vector<int>dist;
void link(int u,int v,int w){
e[++g].obj=v;
e[g].last=head[u];
e[g].val=w;
head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
while(!q.empty()&&pd[q.top().second])q.pop();
if(!q.empty()){
int x=q.top().second;
return {dist[x]-last,x};
}
return {511,0};
}
void update(int u){
pd[u]=true;last=dist[u];
for(int i=head[u];i;i=e[i].last){
int v=e[i].obj,w=e[i].val;
if(dist[v]>dist[u]+w){
dist[v]=dist[u]+w;
q.push({-dist[v],v});
}
}
}
void Init(int x,int len){
for(int i=len-1;i>=0;i--)SendB(x&(1<<i));
}
void InitB(int N,int M,vector<int>U,vector<int>V,vector<int>W){
g=0;
for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
dist.resize(N);
for(int i=1;i<N;i++)dist[i]=1e9;
for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
while(!q.empty())q.pop();
q.push({0,0});
rev=9;op=0;rec=0;update(0);
auto [len,u]=check();Init(len,9);
}
void ReceiveB(bool x){
rec=(rec<<1)|(int)(x);rev--;
if(!rev){
auto [len,u]=check();
if(!op){
if(len<rec){
op=0,rev=9;rec=0;
update(u);
Init(u,11);Init(check().first,9);
}
else sav=rec,op=1,rev=11,rec=0;
}
else {
dist[rec]=sav+last;
update(rec);
op=0;rev=9;rec=0;
Init(check().first,9);
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 5ms
memory: 3876kb
input:
1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 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 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 7ms
memory: 3868kb
input:
1 0 0 1 1 1 0 0 1 -1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 -1 0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 -1 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 1 -1 1 0 0 1 1 0 1 1 1 -1 0 1 0 1 1 1 0 1 1 -1 0 1 0 0 0 1 1 0 0 -1 0 0 0 1 1 1 1 0 0 -1 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 -1 1 0 0...
output:
-1 1 1 0 1 0 0 1 0 1 -1 0 0 1 1 0 1 1 0 0 -1 0 0 1 1 0 1 0 1 0 -1 0 0 0 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 -1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 1 -1 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 1 0 0 0 0 -1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 1 1 1 -1 1 1 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 -1 0...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #4:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 10ms
memory: 3820kb
input:
1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 0 0 1 0 1 0 1 1 -1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 -1 0 0 1 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 1 1 1 1 1 1 1 1 1 -1 1 1 0 1 0 0 0 1 0 -1 0 0 1 1 1 1 1 1 0 -1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 -1 0 1 1 1 1 0 1 0 1 0 0 0 0 ...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 4ms
memory: 3828kb
input:
1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 0 0 0 1 0 1 1 0 0 -1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 -1 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 -1 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 -1 0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 -1 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0...
output:
-1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 -1 0 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 -1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 0 1 0 0 1 1 1 0 -1 0 0 0 0 1 1 1 0 1 -1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1 0 1 1 -1 0 0 1 0 1 1 1 0 1 -1 0 0 1...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #7:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 0ms
memory: 3952kb
input:
1 1 1 1 1 0 0 0 0 -1 1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 -1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 -1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 -1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 -1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 -1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 -1 1 1 1 0 1 1 1 0 0 1 0...
output:
-1 1 1 1 1 1 0 0 1 1 -1 1 1 1 1 1 0 0 1 1 -1 1 1 1 1 1 0 0 1 1 -1 1 0 0 0 1 0 1 0 0 -1 1 0 0 0 1 0 0 1 1 -1 0 0 1 1 1 1 1 1 1 -1 1 1 1 1 0 1 0 0 1 -1 0 1 1 1 1 1 0 1 1 -1 1 1 0 0 0 0 0 0 0 -1 1 1 1 1 0 0 1 1 0 -1 0 1 0 0 0 0 0 0 1 -1 1 1 0 1 0 1 1 1 0 -1 1 1 1 0 1 0 1 0 0 -1 1 1 0 0 0 1 1 0 1 -1 1 1...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''