QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#108798#67. Two Transportationsbashkort#0 15ms4240kbC++204.5kb2023-05-26 17:42:232024-05-31 13:43:29

Judging History

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

  • [2024-05-31 13:43:29]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:4240kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 17:42:23]
  • 提交

Azer

#include "Azer.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    constexpr int maxN = 2000, maxQ = 58001;
    constexpr int inf = 1e9 + 7;

    int N, A, Q = 0, S = 0, usedCnt = 0, T = 0;
    bool last = true;

    vector<pair<int, int>> adj[maxN];
    set<pair<int, int>> st;

    int dist[maxN];
    bool used[maxN], b[maxQ];

    void upd(int v) {
        for (auto [to, w]: adj[v]) {
            if (!used[to] && dist[to] > dist[v] + w) {
                st.erase({dist[to], to});
                st.emplace(dist[to] = dist[v] + w, to);
            }
        }
    }
}

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

    fill(dist, dist + N, inf);
    dist[0] = 0;
    used[0] = true;


    for (int i = 0; i < A; ++i) {
        adj[U[i]].emplace_back(V[i], C[i]);
        adj[V[i]].emplace_back(U[i], C[i]);
    }

    upd(0);

    SendA(1);
    for (int i = 0; i < 20; ++i) {
        SendA(0);
    }
}

void ReceiveA(bool x) {
    b[Q++] = x;
    T += last;

    if (last && b[Q - 1] == 0 || !last && (Q - T) % 20 == 0) {
        int v = -228, d = -228;

        if (!last) {
            v = 0, d = 0;
            int s = Q - 20;

            for (int i = 0; i < 11; ++i) {
                v |= b[s + i] << i;
            }
            for (int i = 0; i < 9; ++i) {
                d |= b[s + 11 + i] << i;
            }

            if (v != 0) {
                st.erase({dist[v], v});
                st.emplace(dist[v] = min(dist[v], S + d), v);
                upd(v);
            }
        }

        last = true;

        if (st.empty()) {
            return;
        }

        auto [dis, to] = *st.begin();
        st.erase(st.begin());
        assert(!used[to]);
        used[to] = true;

        upd(to);

        int diff = dis - S;
        S = dis;

        if (to == v && dis == d) {
            SendA(0);
        } else {
            SendA(1);
            for (int i = 0; i < 11; ++i) {
                SendA(to >> i & 1);
            }
            for (int i = 0; i < 9; ++i) {
                SendA(diff >> i & 1);
            }
        }
    } else {
        last = false;
    }
}

std::vector<int> Answer() {
    std::vector<int> ans(N);
    for (int k = 0; k < N; ++k) {
        ans[k] = dist[k];
    }
    return ans;
}

Baijan

#include "Baijan.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    constexpr int maxN = 2000, maxQ = 58000;
    constexpr int inf = 1e9 + 7;

    int N, B, Q = 0, S = 0, Sh = 0, T = 0;
    bool last = true;

    vector<pair<int, int>> adj[maxN];
    set<pair<int, int>> st;

    int dist[maxN];
    bool used[maxN], b[maxQ];

    void upd(int v) {
        for (auto [to, w]: adj[v]) {
            if (!used[to] && dist[to] > dist[v] + w) {
                st.erase({dist[to], to});
                st.emplace(dist[to] = dist[v] + w, to);
            }
        }
    }
}

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

    fill(dist, dist + N, inf);

    for (int i = 0; i < B; ++i) {
        adj[S[i]].emplace_back(T[i], D[i]);
        adj[T[i]].emplace_back(S[i], D[i]);
    }
}

void ReceiveB(bool y) {
    b[Q++] = y;

    T += last;

    if (last && b[Q - 1] == 0 || !last && (Q - T) % 20 == 0) {
        if (!last) {
            int v = 0, d = 0, s = Q - 20;

            for (int i = 0; i < 11; ++i) {
                v |= b[s + i] << i;
            }
            for (int i = 0; i < 9; ++i) {
                d |= b[s + 11 + i] << i;
            }

            S += d;
            used[v] = true;
            st.erase({dist[v], v});
            dist[v] = S;

//            cerr << "B received: " << v << "; dist0 = " << S << "; diff = " << d << endl;

            upd(v);
        } else {
            S = Sh;
        }

        last = true;

        if (st.empty()) {
            SendB(0);
        } else {
            auto [dis, to] = *st.begin();
//            st.erase(st.begin());
            assert(dis >= S);
            assert(!used[to] && dis >= S);
            Sh = dis;
            upd(to);

            SendB(1);
            for (int i = 0; i < 11; ++i) {
                SendB(to >> i & 1);
            }
            for (int i = 0; i < 9; ++i) {
                SendB((dis - S) >> i & 1);
            }
        }
    } else {
        last = false;
    }
}

詳細信息

Subtask #1:

score: 0
Interactor Runtime Error

Test #1:

score: 0
Interactor Runtime Error

input:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 -1

output:

-1
1 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 -1
1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 -1

input:


output:


result:


Subtask #2:

score: 0
Interactor Runtime Error

Test #7:

score: 8
Accepted
time: 1ms
memory: 3888kb

input:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
-1
-1

output:

-1
0 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Interactor Runtime Error

input:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 -1

output:

-1
1 0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 -1
1 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1

input:


output:


result:


Subtask #3:

score: 0
Wrong Answer

Test #14:

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

input:

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

output:

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

output:

-1
1 1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0 -1
1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 -1

input:


output:


result:


Subtask #5:

score: 0
Interactor Runtime Error

Test #38:

score: 14
Accepted
time: 5ms
memory: 4240kb

input:

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

output:

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

input:


output:

0
3467
3039
3862
3565
4266
3258
4604
3860
2661
3573
3113
2706
3757
4805
4448
4392
3163
3673
4568
3500
3334
3197
2491
4036
2868
3743
4219
2747
3122
3210
2314
3397
3285
2805
2031
2187
3950
3654
3459
3114
3197
1499
5106
3000
3488
3210
3597
4420
3511
4094
3802
3848
2962
4031
3068
4292
3084
4077
4153
407...

result:

ok 1100 lines

Test #39:

score: 14
Accepted
time: 4ms
memory: 3896kb

input:

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

output:

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

input:


output:

0
485
399
2142
681
2834
3651
3030
983
464
2014
2770
2896
691
1552
1351
213
2098
1101
1045
3762
3341
778
644
3199
1965
2409
3611
1656
812
3557
329
613
1997
1194
2828
3289
1513
2336
3551
2512
317
1189
3282
880
3169
1565
3554
637
764
294
1573
3516
3593
756
1533
2643
1941
1944
3766
84
538
2659
3720
21
2...

result:

ok 1100 lines

Test #40:

score: 14
Accepted
time: 3ms
memory: 3892kb

input:

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

output:

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

input:


output:

0
210526
379348
30270
237071
524240
475727
459547
248812
335379
257106
398469
131103
219828
81790
511965
128693
170425
404799
477680
155716
337816
356356
346125
446801
82284
206625
383283
150289
57817
395524
346617
490398
326552
203201
92509
471818
114979
318729
122347
109099
175823
253216
192446
45...

result:

ok 1100 lines

Test #41:

score: 0
Interactor Runtime Error

input:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 -1

output:

-1
1 1 0 0 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 -1
1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1

input:


output:


result:


Subtask #6:

score: 0
Interactor Runtime Error

Test #51:

score: 0
Interactor Runtime Error

input:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 -1

output:

-1
1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 -1
1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 -1

input:


output:


result:


Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 15ms
memory: 4096kb

input:

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

output:

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

input:


output:


result:

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