Submission #747797

#TimeUsernameProblemLanguageResultExecution timeMemory
747797finn__Stray Cat (JOI20_stray)C++17
15 / 100
50 ms16648 KiB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v)
{
    vector<vector<int>> g(n);
    for (size_t i = 0; i < m; ++i)
        g[u[i]].push_back(v[i]), g[v[i]].push_back(u[i]);
    vector<int> ans(m);

    if (a >= 3)
    {
        queue<int> q;
        q.push(0);
        vector<int> d(n, -1);
        d[0] = 0;
        while (!q.empty())
        {
            int const x = q.front();
            q.pop();
            for (auto const &y : g[x])
                if (d[y] == -1)
                {
                    d[y] = d[x] + 1;
                    q.push(y);
                }
        }
        for (size_t i = 0; i < m; ++i)
            ans[i] = min(d[u[i]], d[v[i]]) % 3;
    }

    return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

bool is_tree;
vector<int> colors;

void Init(int a, int b)
{
    colors.clear();
    if (a >= 3)
        is_tree = 0;
    else
        is_tree = 1;
}

int Move(vector<int> y)
{
    if (!is_tree)
    {
        if (!colors.empty())
            y[colors.back()]++;

        if ((bool)y[0] + (bool)y[1] + (bool)y[2] == 1)
        {
            if (y[0])
            {
                colors.push_back(0);
                return 0;
            }
            else if (y[1])
            {
                colors.push_back(1);
                return 1;
            }
            else
            {
                colors.push_back(2);
                return 2;
            }
        }

        if (!y[0])
        {
            colors.push_back(1);
            return 1;
        }
        else if (!y[1])
        {
            colors.push_back(2);
            return 2;
        }
        else
        {
            colors.push_back(0);
            return 0;
        }
    }
    else
    {
    }
}

Compilation message (stderr)

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:8:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |     for (size_t i = 0; i < m; ++i)
      |                        ~~^~~
Anthony.cpp:29:30: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         for (size_t i = 0; i < m; ++i)
      |                            ~~^~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...