답안 #747797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
747797 2023-05-24T18:23:10 Z finn__ 길고양이 (JOI20_stray) C++17
15 / 100
50 ms 16648 KB
#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

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 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 15060 KB Output is correct
2 Correct 1 ms 516 KB Output is correct
3 Correct 31 ms 14748 KB Output is correct
4 Correct 44 ms 16488 KB Output is correct
5 Correct 44 ms 16648 KB Output is correct
6 Correct 45 ms 15080 KB Output is correct
7 Correct 37 ms 15184 KB Output is correct
8 Correct 50 ms 16044 KB Output is correct
9 Correct 41 ms 15900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 15060 KB Output is correct
2 Correct 1 ms 516 KB Output is correct
3 Correct 31 ms 14748 KB Output is correct
4 Correct 44 ms 16488 KB Output is correct
5 Correct 44 ms 16648 KB Output is correct
6 Correct 45 ms 15080 KB Output is correct
7 Correct 37 ms 15184 KB Output is correct
8 Correct 50 ms 16044 KB Output is correct
9 Correct 41 ms 15900 KB Output is correct
10 Correct 32 ms 13176 KB Output is correct
11 Correct 33 ms 13212 KB Output is correct
12 Correct 31 ms 13232 KB Output is correct
13 Correct 33 ms 13208 KB Output is correct
14 Correct 34 ms 13476 KB Output is correct
15 Correct 38 ms 13708 KB Output is correct
16 Correct 41 ms 16112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 12668 KB Output is correct
2 Correct 1 ms 608 KB Output is correct
3 Correct 27 ms 12616 KB Output is correct
4 Correct 40 ms 14368 KB Output is correct
5 Correct 43 ms 14316 KB Output is correct
6 Correct 33 ms 13128 KB Output is correct
7 Correct 34 ms 13076 KB Output is correct
8 Correct 37 ms 13748 KB Output is correct
9 Correct 39 ms 13772 KB Output is correct
10 Correct 36 ms 13392 KB Output is correct
11 Correct 36 ms 13400 KB Output is correct
12 Correct 39 ms 13508 KB Output is correct
13 Correct 37 ms 13592 KB Output is correct
14 Correct 45 ms 13680 KB Output is correct
15 Correct 41 ms 13648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 12668 KB Output is correct
2 Correct 1 ms 608 KB Output is correct
3 Correct 27 ms 12616 KB Output is correct
4 Correct 40 ms 14368 KB Output is correct
5 Correct 43 ms 14316 KB Output is correct
6 Correct 33 ms 13128 KB Output is correct
7 Correct 34 ms 13076 KB Output is correct
8 Correct 37 ms 13748 KB Output is correct
9 Correct 39 ms 13772 KB Output is correct
10 Correct 36 ms 13392 KB Output is correct
11 Correct 36 ms 13400 KB Output is correct
12 Correct 39 ms 13508 KB Output is correct
13 Correct 37 ms 13592 KB Output is correct
14 Correct 45 ms 13680 KB Output is correct
15 Correct 41 ms 13648 KB Output is correct
16 Correct 31 ms 11360 KB Output is correct
17 Correct 28 ms 11312 KB Output is correct
18 Correct 30 ms 11368 KB Output is correct
19 Correct 32 ms 11300 KB Output is correct
20 Correct 35 ms 12052 KB Output is correct
21 Correct 36 ms 11812 KB Output is correct
22 Correct 40 ms 13984 KB Output is correct
23 Correct 34 ms 11316 KB Output is correct
24 Correct 33 ms 11476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 896 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 10316 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 10124 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -