Submission #708205

# Submission time Handle Problem Language Result Execution time Memory
708205 2023-03-11T09:52:28 Z LittleCube Two Transportations (JOI19_transportations) C++14
0 / 100
320 ms 1176 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() / 31; i++)
        {
            unsigned cur = 0;
            for (int p = 0; p < 31; p++)
                cur = cur * 2 + receive[i * 31 + p];
            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++)
        {
            unsigned cur = S[i] * 2000 * 500 + T[i] * 500 + D[i] - 1;
            for (int i = 0; i < N; i++)
                for (int p = 30; 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() / 31; i++)
      |                         ~~^~~~~~~~~~~~~~~~~~~~~
Azer.cpp:54:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for (int i = 0; i < U.size(); i++)
      |                         ~~^~~~~~~~~~
Azer.cpp:63:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   63 |             auto [d, u] = pq.top();
      |                  ^
Azer.cpp:67:23: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   67 |             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 Incorrect 320 ms 1176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Runtime error 1 ms 328 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 320 ms 1176 KB Output isn't correct
2 Halted 0 ms 0 KB -