답안 #961858

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
961858 2024-04-12T14:59:06 Z Sharky 길고양이 (JOI20_stray) C++17
15 / 100
45 ms 17364 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int, int>
#define fi first
#define se second
#define sz(x) (int)x.size()

namespace ivan {
    const int INF = 1e9;
    vector<vector<pair<int, int>>> adj;
    vector<int> dist, c;
    vector<pair<int, int>> e;
    queue<int> q;
    vector<bool> vis;
};

using namespace ivan;

vector<int> Mark(int n, int m, int a, int b,
                      vector<int> u, vector<int> v) {
    vector<int> x(m);
    adj.resize(n);
    c.resize(m);
    dist.assign(n, INF);
    vis.assign(n, 0);
    for (int i = 0; i < m; i++) {
        adj[u[i]].push_back({v[i], i});
        adj[v[i]].push_back({u[i], i});
        e.push_back({u[i], v[i]});
    }
    dist[0] = 0;
    q.push(0);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (auto& [v, id] : adj[u]) {
            if (dist[v] > dist[u] + 1) {
                dist[v] = dist[u] + 1;
                q.push(v);
            }
        }
    }
    for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
    return c;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

namespace ivan {
    int a, b;
};

using namespace ivan;

void Init(int A, int B) {
    a = A, b = B;
}

int Move(vector<int> cnt) {
    set<int> hv;
    for (int i = 0; i < a; i++) if (cnt[i]) hv.insert(i);
    if ((int) hv.size() == 1) return *hv.begin();
    if (!hv.count(1)) return 2;
    if (!hv.count(2)) return 0;
    if (!hv.count(0)) return 1;
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:45: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]
   45 |     for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
      |                     ~~^~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:16:14: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     set<int> hv;
      |              ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 16284 KB Output is correct
2 Correct 2 ms 788 KB Output is correct
3 Correct 27 ms 15864 KB Output is correct
4 Correct 36 ms 17364 KB Output is correct
5 Correct 39 ms 17364 KB Output is correct
6 Correct 27 ms 16076 KB Output is correct
7 Correct 28 ms 16008 KB Output is correct
8 Correct 35 ms 16836 KB Output is correct
9 Correct 32 ms 16856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 16284 KB Output is correct
2 Correct 2 ms 788 KB Output is correct
3 Correct 27 ms 15864 KB Output is correct
4 Correct 36 ms 17364 KB Output is correct
5 Correct 39 ms 17364 KB Output is correct
6 Correct 27 ms 16076 KB Output is correct
7 Correct 28 ms 16008 KB Output is correct
8 Correct 35 ms 16836 KB Output is correct
9 Correct 32 ms 16856 KB Output is correct
10 Correct 26 ms 14276 KB Output is correct
11 Correct 25 ms 14244 KB Output is correct
12 Correct 26 ms 14096 KB Output is correct
13 Correct 25 ms 14280 KB Output is correct
14 Correct 26 ms 14636 KB Output is correct
15 Correct 32 ms 14792 KB Output is correct
16 Correct 40 ms 16840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13776 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 23 ms 13372 KB Output is correct
4 Correct 32 ms 15064 KB Output is correct
5 Correct 34 ms 15312 KB Output is correct
6 Correct 26 ms 13752 KB Output is correct
7 Correct 26 ms 13780 KB Output is correct
8 Correct 31 ms 14624 KB Output is correct
9 Correct 36 ms 14800 KB Output is correct
10 Correct 28 ms 14288 KB Output is correct
11 Correct 27 ms 14248 KB Output is correct
12 Correct 28 ms 14224 KB Output is correct
13 Correct 30 ms 14452 KB Output is correct
14 Correct 45 ms 14396 KB Output is correct
15 Correct 30 ms 14648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13776 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 23 ms 13372 KB Output is correct
4 Correct 32 ms 15064 KB Output is correct
5 Correct 34 ms 15312 KB Output is correct
6 Correct 26 ms 13752 KB Output is correct
7 Correct 26 ms 13780 KB Output is correct
8 Correct 31 ms 14624 KB Output is correct
9 Correct 36 ms 14800 KB Output is correct
10 Correct 28 ms 14288 KB Output is correct
11 Correct 27 ms 14248 KB Output is correct
12 Correct 28 ms 14224 KB Output is correct
13 Correct 30 ms 14452 KB Output is correct
14 Correct 45 ms 14396 KB Output is correct
15 Correct 30 ms 14648 KB Output is correct
16 Correct 25 ms 12172 KB Output is correct
17 Correct 26 ms 12368 KB Output is correct
18 Correct 26 ms 12240 KB Output is correct
19 Correct 35 ms 12200 KB Output is correct
20 Correct 35 ms 13128 KB Output is correct
21 Correct 31 ms 12496 KB Output is correct
22 Correct 34 ms 14560 KB Output is correct
23 Correct 30 ms 12436 KB Output is correct
24 Correct 26 ms 12244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 788 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3180 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3156 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -