QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#716283#67. Two TransportationsEstelle_N0 13ms4256kbC++204.2kb2024-11-06 14:51:032024-11-06 14:51:03

Judging History

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

  • [2024-11-06 14:51:03]
  • 评测
  • 测评结果:0
  • 用时:13ms
  • 内存:4256kb
  • [2024-11-06 14:51:03]
  • 提交

Azer

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

using namespace std;

const int MAXN = 2005;

namespace A
{
    int n, m, num, pos, val, lasdis, vis[MAXN];

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

    void solve(int u)
    {
        // printf("Point: %d\n", 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;

        ++ num;
        solve(0);
    }

    int w, cnt, type;

    void ReceiveA(bool x)
    {
        ++ cnt;
        w = w * 2 + x;
        if(type == 0 && cnt == 9)
        {
            // printf("Dis: %d\n", w);
            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;
                dis[pos] = lasdis;
                if(++ num < n)
                    solve(pos);
                w = 0;
            }
        }
        else if(type == 1 && cnt == 11)
        {
            // printf("BPoint: %d\n", w);
            cnt = 0;
            dis[w] = lasdis;
            if(++ num < n)
                solve(w);
            w = 0;
            type = 0;
        }
    }
}

void InitA(int N, int A, vector <int> U, vector <int> V, vector <int> C)
{
    A::InitA(N, A, U, V, C);
}

void ReceiveA(bool x)
{
    A::ReceiveA(x);
}

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

Baijan

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

using namespace std;

const int MAXN = 2005;

namespace B
{
    int n, m, num, pos, val, lasdis, vis[MAXN];

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

    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;

        // printf("Pos: %d\n", pos);
        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;

        ++ num;
        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;
                dis[pos] = lasdis;
                if(++ num < n)
                    solve(pos);
                w = 0;
            }
        }
        else if(type == 1 && cnt == 11)
        {
            cnt = 0;
            dis[w] = lasdis;
            if(++ num < n)
                solve(w);
            w = 0;
            type = 0;
        }
    }
}

void InitB(int N, int B, vector <int> S, vector <int> T, vector <int> D)
{
    B::InitB(N, B, S, T, D);
}

void ReceiveB(bool x)
{
    B::ReceiveB(x);
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 6
Accepted
time: 12ms
memory: 4256kb

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

input:


output:

0
2417
4435
3092
3018
2637
2136
3353
4117
2498
3522
3354
2776
1912
3232
3382
2310
2867
3546
2681
2605
3912
3045
3311
1307
2094
1352
3087
3487
3865
3223
4033
3647
2816
2468
1263
2756
3086
1735
3002
2385
2754
2837
3718
2891
2201
3478
3041
2726
3012
2634
2599
914
3509
4886
2317
4081
1993
2391
2749
3551...

result:

ok 2000 lines

Test #2:

score: 0
Wrong Answer
time: 4ms
memory: 4152kb

input:

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

output:

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

input:


output:


result:

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

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 4ms
memory: 3864kb

input:

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

output:

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

input:


output:


result:

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

Subtask #3:

score: 0
Runtime Error

Test #14:

score: 0
Runtime Error

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
Interactor Runtime Error

Test #24:

score: 0
Interactor Runtime Error

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


Subtask #6:

score: 0
Interactor Runtime Error

Test #51:

score: 0
Interactor Runtime Error

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:


Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 13ms
memory: 4100kb

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: ''