QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#716086#67. Two TransportationsEstelle_N0 9ms3976kbC++202.9kb2024-11-06 14:18:402024-11-06 14:18:41

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 14:18:41]
  • 评测
  • 测评结果:0
  • 用时:9ms
  • 内存:3976kb
  • [2024-11-06 14:18:40]
  • 提交

Azer

#include "Azer.h"
#include <vector>

using namespace std;

const int N = 2005;

int n, m, pos, val, lasdis, vis[N];

vector < int > dis;
vector < pair <int, int> > e[N];

void solve(int u)
{
    vis[u] = 1;
    for(auto [v, w] : e[u])
        dis[v] = min(dis[v], dis[u] + w);

    pos = 0;
    for(int i = 0; i < N; ++ i)
        if(!vis[i] && (dis[i] < dis[pos] || !pos))
            pos = i;

    val = min(dis[pos] - lasdis, 511);
    for(int i = 8; i >= 0; -- i)
        SendA(val >> i & 1);
}

void InitA(int N, int A, vector <int> U, vector <int> V, vector <int> C)
{
    n = N;
    m = A;
    dis.resize(N);
    for(int i = 0; i < A; ++ i)
    {
        e[U[i]].push_back({V[i], C[i]});
        e[V[i]].push_back({U[i], C[i]});
    }

    for(int i = 1; i < N; ++ i)
        dis[i] = 1000000000;
    solve(0);
}

int w, cnt, type;

void ReceiveA(bool x)
{
    ++ cnt;
    w = w * 2 + x;
    if(type == 0 && cnt == 9)
    {
        cnt = 0;
        if(w < val)
        {
            lasdis += w;
            type = 1;
            w = 0;
        }
        else
        {
            for(int i = 10; i >= 0; -- i)
                SendA(pos >> i & 1);
            lasdis += val;
            solve(pos);
            w = 0;
        }
    }
    else if(type == 1 && cnt == 11)
    {
        cnt = 0;
        dis[w] = lasdis;
        solve(w);
        w = 0;
        type = 0;
    }
}

vector <int> Answer()
{
    return dis;
}

Baijan

#include "Baijan.h"
#include <vector>

using namespace std;

const int N = 2005;

int n, m, pos, val, lasdis, vis[N];

vector < int > dis;
vector < pair <int, int> > e[N];

void solve(int u)
{
    vis[u] = 1;
    for(auto [v, w] : e[u])
        dis[v] = min(dis[v], dis[u] + w);

    pos = 0;
    for(int i = 0; i < N; ++ i)
        if(!vis[i] && (dis[i] < dis[pos] || !pos))
            pos = i;

    val = min(dis[pos] - lasdis, 511);
    for(int i = 8; i >= 0; -- i)
        SendB(val >> i & 1);
}

void InitB(int N, int B, vector <int> S, vector <int> T, vector <int> D)
{
    n = N;
    m = B;
    dis.resize(N);
    for(int i = 0; i < B; ++ i)
    {
        e[S[i]].push_back({T[i], D[i]});
        e[T[i]].push_back({S[i], D[i]});
    }

    for(int i = 1; i < N; ++ i)
        dis[i] = 1000000000;
    solve(0);
}

int w, cnt, type;

void ReceiveB(bool x)
{
    ++ cnt;
    w = w * 2 + x;
    if(type == 0 && cnt == 9)
    {
        cnt = 0;
        if(w < val)
        {
            lasdis += w;
            type = 1;
            w = 0;
        }
        else
        {
            for(int i = 10; i >= 0; -- i)
                SendB(pos >> i & 1);
            lasdis += val;
            solve(pos);
            w = 0;
        }
    }
    else if(type == 1 && cnt == 11)
    {
        cnt = 0;
        dis[w] = lasdis;
        solve(w);
        w = 0;
        type = 0;
    }
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 3976kb

input:

0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 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 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 ...

output:

-1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 0 -1
0 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 0 1 1 0 0 1 0 1 1 1 1 0...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #2:

score: 0
Runtime Error

Test #7:

score: 0
Runtime Error

input:

0 0 0 0 0 0 0 0 0 -1
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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 ...

output:

-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 -1
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 1 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 ...

input:


output:

0

result:

ok single line: '0'

Subtask #3:

score: 0
Runtime Error

Test #14:

score: 0
Runtime Error

input:

0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 -1
1 1 1 1 1 0 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 ...

output:

-1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 -1
0 1 1 1 0 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #4:

score: 0
Interactor Runtime Error

Test #24:

score: 0
Interactor Runtime Error

input:

0 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 ...

output:

-1
0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 ...

input:


output:


result:


Subtask #5:

score: 0
Interactor Runtime Error

Test #38:

score: 0
Interactor Runtime Error

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 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 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 ...

output:

-1
0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 ...

input:


output:


result:


Subtask #6:

score: 0
Interactor Runtime Error

Test #51:

score: 0
Interactor Runtime Error

input:

0 0 0 0 0 0 0 0 0 -1
1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 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1 1 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 1 0 -1
0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 0 1 0 0...

input:


output:


result: