답안 #978726

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
978726 2024-05-09T14:38:49 Z andrei_iorgulescu 길고양이 (JOI20_stray) C++14
15 / 100
34 ms 17104 KB
#include "Anthony.h"
#include <bits/stdc++.h>

using namespace std;

int n,m,AA,BB;
vector<int> g[20005];
vector<pair<int,int>> e;
vector<int> d;

void bfs()
{
    d.resize(n);
    for (int i = 0; i < n; i++)
        d[i] = 1e9;
    d[0] = 0;
    queue<int> q;
    q.push(0);
    while (!q.empty())
    {
        int nod = q.front();
        q.pop();
        for (auto vecin : g[nod])
        {
            if (d[vecin] == 1e9)
            {
                d[vecin] = 1 + d[nod];
                q.push(vecin);
            }
        }
    }
}

vector<int> solve1()
{
    bfs();
    vector<int> ans(m);
    for (int i = 0; i < e.size(); i++)
    {
        int x = e[i].first,y = e[i].second;
        ans[i] = min(d[x],d[y]) % 3;
    }
    return ans;
}

vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V)
{
    n = N,m = M;
    AA = A,BB = B;
    for (int i = 0; i < m; i++)
    {
        g[U[i]].push_back(V[i]);
        g[V[i]].push_back(U[i]);
        e.push_back({U[i],V[i]});
    }
    if (A >= 3)
    {
        return solve1();
    }
}

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

using namespace std;

//int A1,B1;

void Init(int A, int B)
{

}

int Move(vector<int> y)
{
    if (y[0] == 0 and y[1] == 0)
        return 2;
    if (y[1] == 0 and y[2] == 0)
        return 0;
    if (y[0] == 0 and y[2] == 0)
        return 1;
    if (y[2] == 0)
        return 0;
    if (y[0] == 0)
        return 1;
    return 2;
}

Compilation message

Anthony.cpp: In function 'std::vector<int> solve1()':
Anthony.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i = 0; i < e.size(); i++)
      |                     ~~^~~~~~~~~~
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 16096 KB Output is correct
2 Correct 1 ms 1308 KB Output is correct
3 Correct 25 ms 15552 KB Output is correct
4 Correct 34 ms 17092 KB Output is correct
5 Correct 33 ms 17104 KB Output is correct
6 Correct 26 ms 16060 KB Output is correct
7 Correct 26 ms 16088 KB Output is correct
8 Correct 32 ms 16636 KB Output is correct
9 Correct 31 ms 16736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 16096 KB Output is correct
2 Correct 1 ms 1308 KB Output is correct
3 Correct 25 ms 15552 KB Output is correct
4 Correct 34 ms 17092 KB Output is correct
5 Correct 33 ms 17104 KB Output is correct
6 Correct 26 ms 16060 KB Output is correct
7 Correct 26 ms 16088 KB Output is correct
8 Correct 32 ms 16636 KB Output is correct
9 Correct 31 ms 16736 KB Output is correct
10 Correct 27 ms 14028 KB Output is correct
11 Correct 25 ms 14040 KB Output is correct
12 Correct 25 ms 14076 KB Output is correct
13 Correct 26 ms 14032 KB Output is correct
14 Correct 26 ms 14188 KB Output is correct
15 Correct 27 ms 14560 KB Output is correct
16 Correct 30 ms 16592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13572 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13248 KB Output is correct
4 Correct 32 ms 15060 KB Output is correct
5 Correct 31 ms 15088 KB Output is correct
6 Correct 27 ms 13784 KB Output is correct
7 Correct 26 ms 13780 KB Output is correct
8 Correct 28 ms 14424 KB Output is correct
9 Correct 30 ms 14332 KB Output is correct
10 Correct 30 ms 14120 KB Output is correct
11 Correct 27 ms 14260 KB Output is correct
12 Correct 27 ms 14176 KB Output is correct
13 Correct 34 ms 14448 KB Output is correct
14 Correct 28 ms 14444 KB Output is correct
15 Correct 31 ms 14420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13572 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13248 KB Output is correct
4 Correct 32 ms 15060 KB Output is correct
5 Correct 31 ms 15088 KB Output is correct
6 Correct 27 ms 13784 KB Output is correct
7 Correct 26 ms 13780 KB Output is correct
8 Correct 28 ms 14424 KB Output is correct
9 Correct 30 ms 14332 KB Output is correct
10 Correct 30 ms 14120 KB Output is correct
11 Correct 27 ms 14260 KB Output is correct
12 Correct 27 ms 14176 KB Output is correct
13 Correct 34 ms 14448 KB Output is correct
14 Correct 28 ms 14444 KB Output is correct
15 Correct 31 ms 14420 KB Output is correct
16 Correct 23 ms 12032 KB Output is correct
17 Correct 23 ms 11980 KB Output is correct
18 Correct 24 ms 11992 KB Output is correct
19 Correct 24 ms 11904 KB Output is correct
20 Correct 27 ms 12744 KB Output is correct
21 Correct 26 ms 12564 KB Output is correct
22 Correct 27 ms 14552 KB Output is correct
23 Correct 25 ms 12260 KB Output is correct
24 Correct 24 ms 12192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1312 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2944 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2924 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -