Submission #708209

# Submission time Handle Problem Language Result Execution time Memory
708209 2023-03-11T10:04:48 Z LittleCube Two Transportations (JOI19_transportations) C++14
6 / 100
345 ms 10676 KB
#include "Azer.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

namespace
{
    int N;
    bool state;
    vector<int> receive, U, V, C;
} // namespace
vector<int> E[2005];

void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C)
{
    ::N = N;
    ::U = U;
    ::V = V;
    ::C = C;
    SendA(state = U.empty());
}

void ReceiveA(bool x)
{
    receive.emplace_back(x);
}

std::vector<int> Answer()
{
    vector<int> ans(N);
    if (state)
    {
        for (int i = 0; i < N; i++)
            for (int p = 0; p < 20; p++)
                ans[i] = ans[i] * 2 + receive[i * 20 + p];
    }
    else
    {
        for (int i = 0; i < receive.size() / 32; i++)
        {
            long long cur = 0;
            for (int p = 0; p < 32; p++)
                cur = cur * 2 + receive[i * 32 + p];
            cerr << i << ' ' << (cur / 500 / 2000) << ' ' << (cur / 500 % 2000) << ' ' << (cur % 500 + 1) << '\n';
            U.emplace_back(cur / 500 / 2000);
            V.emplace_back(cur / 500 % 2000);
            C.emplace_back(cur % 500 + 1);
        }

        vector<int> dis(N, 1'000'000'000);
        vector<pii> E[2000];
        dis[0] = 0;
        for (int i = 0; i < U.size(); i++)
        {
            E[U[i]].emplace_back(pii(V[i], C[i]));
            E[V[i]].emplace_back(pii(U[i], C[i]));
        }
        priority_queue<pii, vector<pii>, greater<pii>> pq;
        pq.push(pii(0, 0));
        while (!pq.empty())
        {
            auto [d, u] = pq.top();
            pq.pop();
            if (d > dis[u])
                continue;
            for (auto [v, w] : E[u])
                if (d + w < dis[v])
                {
                    dis[v] = d + w;
                    pq.push(pii(dis[v], v));
                }
        }
        ans = dis;
    }
    return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

namespace
{
    int N;
    vector<int> receive, S, T, D;
}

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

void ReceiveB(bool y)
{
    if (y)
    {
        vector<int> dis(N, 1'000'000'000);
        vector<pii> E[2000];
        dis[0] = 0;
        for (int i = 0; i < S.size(); i++)
        {
            E[S[i]].emplace_back(pii(T[i], D[i]));
            E[T[i]].emplace_back(pii(S[i], D[i]));
        }
        priority_queue<pii, vector<pii>, greater<pii>> pq;
        pq.push(pii(0, 0));
        while (!pq.empty())
        {
            auto [d, u] = pq.top();
            pq.pop();
            if (d > dis[u])
                continue;
            for (auto [v, w] : E[u])
                if (d + w < dis[v])
                {
                    dis[v] = d + w;
                    pq.push(pii(dis[v], v));
                }
        }
        for (int i = 0; i < N; i++)
            for (int p = 19; p >= 0; p--)
                SendB((dis[i] >> p) & 1);
    }
    else
    {
        for (int i = 0; i < S.size(); i++)
        {
            long long cur = S[i] * 2000 * 500 + T[i] * 500 + D[i] - 1;
            for (int p = 32; p >= 0; p--)
                SendB((cur >> p) & 1);
        }
    }
}

Compilation message

Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:41:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for (int i = 0; i < receive.size() / 32; i++)
      |                         ~~^~~~~~~~~~~~~~~~~~~~~
Azer.cpp:55:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         for (int i = 0; i < U.size(); i++)
      |                         ~~^~~~~~~~~~
Azer.cpp:64:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   64 |             auto [d, u] = pq.top();
      |                  ^
Azer.cpp:68:23: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   68 |             for (auto [v, w] : E[u])
      |                       ^

Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:29:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for (int i = 0; i < S.size(); i++)
      |                         ~~^~~~~~~~~~
Baijan.cpp:38:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   38 |             auto [d, u] = pq.top();
      |                  ^
Baijan.cpp:42:23: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   42 |             for (auto [v, w] : E[u])
      |                       ^
Baijan.cpp:55:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         for (int i = 0; i < S.size(); i++)
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 162 ms 1176 KB Output is correct
2 Correct 2 ms 664 KB Output is correct
3 Correct 345 ms 1288 KB Output is correct
4 Correct 313 ms 10676 KB Output is correct
5 Correct 20 ms 924 KB Output is correct
6 Correct 318 ms 2608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Runtime error 308 ms 1108 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 275 ms 1076 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 136 ms 836 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 136 ms 836 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 136 ms 836 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 162 ms 1176 KB Output is correct
2 Correct 2 ms 664 KB Output is correct
3 Correct 345 ms 1288 KB Output is correct
4 Correct 313 ms 10676 KB Output is correct
5 Correct 20 ms 924 KB Output is correct
6 Correct 318 ms 2608 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Runtime error 308 ms 1108 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -