QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#377094 | #67. Two Transportations | Ustinian26 | 0 | 18ms | 4144kb | C++20 | 3.2kb | 2024-04-04 21:44:33 | 2024-04-04 21:44:33 |
Judging History
Azer
#include"Azer.h"
#include<bits/stdc++.h>
#define L(i,s,t) for(int i=(s);i<=(t);++i)
#define R(i,s,t) for(int i=(s);i>=(t);--i)
#define T(i,s,t) for(int i=(s);i< (t);++i)
#define iV inline void
#define iI inline int
#define iB inline bool
#define vc vector
#define vi vc<int>
#define eb emplace_back
#define sz(x) (int)(x).size()
#define I(x) (1<<(x))
#define all(x) x.begin(),x.end()
using namespace std;
namespace {
const int N=2003,M=1e6+3,inf=1e9;
int n,Lg[N],h[N],tot;
int dis,ide,cur,typ,Ids,Ide;
int las;//上次的值
vi p,d;//存储剩余点集
struct edge{int v,w,nxt;}e[M];
iV add(int u,int v,int w) {e[++tot]={v,w,h[u]},h[u]=tot;}
iV lnk(int u,int v,int w) {add(u,v,w),add(v,u,w);}
iB chn(int &x,int y) {return x>y?(x=y,1):0;}
iV upd(int x,int y) {
d[x]=las=las+y,p.erase(find(all(p),x));
if(p.empty()) return;
for(int i=h[x];i;i=e[i].nxt) chn(d[e[i].v],d[x]+e[i].w);
dis=501,ide=typ=Ids=Ide=0,cur=8;
T(i,0,sz(p)) if(chn(dis,d[p[i]]-d[x])) ide=i;
R(i,8,0) SendA(dis>>i&1);
}
}
void InitA(int Tn,int A,vi U,vi V,vi C) {
n=Tn,d.resize(n);
L(i,2,n) Lg[i]=Lg[i>>1]+1;
T(i,0,n) p.eb(i),d[i]=501;
T(i,0,A) lnk(U[i],V[i],C[i]);
upd(0,0);
}
void ReceiveA(bool x) {
if(!typ) {
Ids|=x<<cur--;
if(cur<0) {
if(Ids>dis) {
R(i,Lg[sz(p)-1],0) SendA(ide>>i&1);
return upd(p[ide],dis);
}
cur=Lg[sz(p)-1],typ=1;
}
}
else {
Ide|=x<<cur--;
if(cur<0) return upd(p[Ide],Ids);
}
}
vi Answer() {return d;}
Baijan
#include "Baijan.h"
#include <bits/stdc++.h>
#define L(i,s,t) for(int i=(s);i<=(t);++i)
#define R(i,s,t) for(int i=(s);i>=(t);--i)
#define T(i,s,t) for(int i=(s);i< (t);++i)
#define iV inline void
#define iI inline int
#define iB inline bool
#define vc vector
#define vi vc<int>
#define eb emplace_back
#define sz(x) (int)(x).size()
#define I(x) (1<<(x))
#define all(x) x.begin(),x.end()
using namespace std;
namespace {
const int N=2003,M=1e6+3,inf=1e9;
int n,Lg[N],h[N],tot;
int dis,ide,cur,typ,Ids,Ide,las;
vi p,d;
struct edge{int v,w,nxt;}e[M];
iV add(int u,int v,int w) {e[++tot]={v,w,h[u]},h[u]=tot;}
iV lnk(int u,int v,int w) {add(u,v,w),add(v,u,w);}
iB chn(int &x,int y) {return x>y?(x=y,1):0;}
iV upd(int x,int y) {
d[x]=las=las+y,p.erase(find(all(p),x));
if(p.empty()) return;
for(int i=h[x];i;i=e[i].nxt) chn(d[e[i].v],d[x]+e[i].w);
dis=501,ide=typ=Ids=Ide=0,cur=8;
T(i,0,sz(p)) if(chn(dis,d[p[i]]-d[x])) ide=i;
R(i,8,0) SendB(dis>>i&1);
}
}
void InitB(int Tn,int A,vi U,vi V,vi C) {
n=Tn,d.resize(n);
L(i,2,n) Lg[i]=Lg[i>>1]+1;
T(i,0,n) p.eb(i),d[i]=501;
T(i,0,A) lnk(U[i],V[i],C[i]);
upd(0,0);
}
void ReceiveB(bool x) {
if(!typ) {
Ids|=x<<cur--;
if(cur<0) {
if(Ids>=dis) {
R(i,Lg[sz(p)-1],0) SendB(ide>>i&1);
return upd(p[ide],dis);
}
cur=Lg[sz(p)-1],typ=1;
}
}
else {
Ide|=x<<cur--;
if(cur<0) return upd(p[Ide],Ids);
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 3920kb
input:
1 1 1 1 1 0 1 0 1 -1 1 0 1 0 0 0 0 0 1 -1 0 1 0 1 1 0 0 1 0 -1 0 1 0 0 1 1 0 0 1 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 ...
output:
-1 0 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 -1 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 0 1 -1 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1 1 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '2417', found: '501'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 8
Accepted
time: 1ms
memory: 4008kb
input:
-1
output:
-1 -1
input:
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Wrong Answer
time: 12ms
memory: 3880kb
input:
1 1 1 1 1 0 1 0 1 -1 1 0 0 1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 ...
output:
-1 0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '128264', found: '501'
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 14ms
memory: 3832kb
input:
1 0 0 1 1 1 0 0 1 -1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 -1 0 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 -1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 1 -1 0 0 1 0 1 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -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 0 0 1 0 0 1 0 1 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 392 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '3328', found: '501'
Subtask #4:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
1 1 1 1 1 0 1 0 1 -1 1 0 1 1 0 0 0 1 0 -1 0 0 1 1 1 0 1 0 0 -1 0 0 0 1 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 ...
output:
-1 0 1 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 -1 0 0 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 -1 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '1881', found: '501'
Subtask #5:
score: 0
Wrong Answer
Test #38:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
input:
0 0 1 0 1 1 1 1 0 -1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 -1 0 0 0 1 0 1 0 1 0 -1 0 0 0 1 0 1 0 1 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0...
output:
-1 1 1 1 1 1 0 1 0 1 -1 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 1 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 ...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '3467', found: '501'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 11ms
memory: 4144kb
input:
1 1 1 1 1 0 1 0 1 -1 1 0 1 0 0 0 1 0 1 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 ...
output:
-1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '4745', found: '501'
Subtask #7:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 18ms
memory: 3988kb
input:
1 1 1 1 1 0 0 0 0 -1 1 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 0 1 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0...
output:
-1 1 1 1 1 1 0 0 1 1 -1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 ...
input:
output:
0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...
result:
wrong answer 2nd lines differ - expected: '25855', found: '501'