답안 #827285

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827285 2023-08-16T10:34:03 Z wortelworm 길고양이 (JOI20_stray) C++17
15 / 100
45 ms 16112 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

// namespace {

// int FunctionExample(int i, int A) {
//   return i % A;
// }

// }  // namespace

vector<int> Mark(int N, int M, int MarkerTypes, int Speling, vector<int> U, vector<int> V) {

    // A -> [{b, index}]
    vector<vector<pair<int, int>>> adj(N);
    for (int i = 0; i < M; i++)
    {
        adj[U[i]].push_back({V[i], i});
        adj[V[i]].push_back({U[i], i});
    }

    vector<int> markings(M, 3);
    vector<int> depth(N, 1e9);
    queue<int> todo;

    depth[0] = 0;
    todo.push(0);

    while (! todo.empty()) {
        int node = todo.front();
        int next_depth = depth[node] + 1;
        todo.pop();
        for (auto [other, index] : adj[node]) {
            if (depth[other] <= next_depth) {
                continue;
            }
            depth[other] = next_depth;
            markings[index] = next_depth % 3;
            todo.push(other);
        }
    }

    // filter out the marking 3 with a marking going deeper
    for (int i = 0; i < M; i++)
    {
        if (markings[i] != 3) {
            continue;
        }
        
        markings[i] = (min(depth[U[i]], depth[V[i]])+1) % 3;
    }
    

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

// namespace {

// int A, B;
// int variable_example = 0;

// }  // namespace

void Init(int A, int B) {
    // ::A = A;
    // ::B = B;
}

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


    // ++variable_example;
    // for (int j = 0; j < A; ++j) {
    //   if (y[j] != 0) {
    //     return j;
    //   }
    // }
    // return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 15064 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 25 ms 14372 KB Output is correct
4 Correct 37 ms 16112 KB Output is correct
5 Correct 34 ms 16112 KB Output is correct
6 Correct 38 ms 14828 KB Output is correct
7 Correct 26 ms 14812 KB Output is correct
8 Correct 45 ms 15504 KB Output is correct
9 Correct 33 ms 15580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 15064 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 25 ms 14372 KB Output is correct
4 Correct 37 ms 16112 KB Output is correct
5 Correct 34 ms 16112 KB Output is correct
6 Correct 38 ms 14828 KB Output is correct
7 Correct 26 ms 14812 KB Output is correct
8 Correct 45 ms 15504 KB Output is correct
9 Correct 33 ms 15580 KB Output is correct
10 Correct 26 ms 12924 KB Output is correct
11 Correct 25 ms 13368 KB Output is correct
12 Correct 25 ms 13316 KB Output is correct
13 Correct 31 ms 13400 KB Output is correct
14 Correct 33 ms 13604 KB Output is correct
15 Correct 39 ms 13864 KB Output is correct
16 Correct 44 ms 15976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 12648 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 24 ms 12216 KB Output is correct
4 Correct 32 ms 13932 KB Output is correct
5 Correct 31 ms 14084 KB Output is correct
6 Correct 27 ms 12700 KB Output is correct
7 Correct 31 ms 12536 KB Output is correct
8 Correct 31 ms 13260 KB Output is correct
9 Correct 34 ms 13292 KB Output is correct
10 Correct 30 ms 13036 KB Output is correct
11 Correct 27 ms 13056 KB Output is correct
12 Correct 30 ms 13036 KB Output is correct
13 Correct 30 ms 13056 KB Output is correct
14 Correct 32 ms 13388 KB Output is correct
15 Correct 30 ms 13204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 12648 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 24 ms 12216 KB Output is correct
4 Correct 32 ms 13932 KB Output is correct
5 Correct 31 ms 14084 KB Output is correct
6 Correct 27 ms 12700 KB Output is correct
7 Correct 31 ms 12536 KB Output is correct
8 Correct 31 ms 13260 KB Output is correct
9 Correct 34 ms 13292 KB Output is correct
10 Correct 30 ms 13036 KB Output is correct
11 Correct 27 ms 13056 KB Output is correct
12 Correct 30 ms 13036 KB Output is correct
13 Correct 30 ms 13056 KB Output is correct
14 Correct 32 ms 13388 KB Output is correct
15 Correct 30 ms 13204 KB Output is correct
16 Correct 23 ms 11112 KB Output is correct
17 Correct 24 ms 11112 KB Output is correct
18 Correct 24 ms 11072 KB Output is correct
19 Correct 24 ms 11452 KB Output is correct
20 Correct 27 ms 12080 KB Output is correct
21 Correct 33 ms 11824 KB Output is correct
22 Correct 30 ms 13868 KB Output is correct
23 Correct 25 ms 11580 KB Output is correct
24 Correct 25 ms 11568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 516 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2320 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2328 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -