답안 #868039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
868039 2023-10-30T09:43:38 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 23712 KB
#include "werewolf.h"
using namespace std;
#include <bits/stdc++.h>


std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
        int Q = L.size(), M = X.size();
        vector<vector<int>> adj(N);
        for (int i = 0; i < M; i++) adj[X[i]].emplace_back(Y[i]);
        for (int i = 0; i < M; i++) adj[Y[i]].emplace_back(X[i]);

        auto bfs = [&](int u, int l, int r) {
                assert(l <= u && u <= r);
                vector<int> done(N, 0);
                done[u] = 1;
                queue<int> q;
                q.emplace(u);
                while (q.size()) {
                        int u = q.front();
                        q.pop();
                        for (int v : adj[u]) {
                                if (!done[v] && l <= v && v <= r) {
                                        done[v] = 1;
                                        q.emplace(v);
                                }
                        }
                }
                return done;
        };

        vector<int> A(Q);

        for (int i = 0; i < Q; i++) {
                auto ds = bfs(S[i], L[i], N);
                auto de = bfs(E[i], 0, R[i]);
                for (int j = 0; j < N; j++) {
                        if (de[j] && ds[j]) A[i] = 1;
                }
        }

        return A;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 235 ms 860 KB Output is correct
11 Correct 142 ms 860 KB Output is correct
12 Correct 16 ms 856 KB Output is correct
13 Correct 249 ms 856 KB Output is correct
14 Correct 165 ms 860 KB Output is correct
15 Correct 211 ms 984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4093 ms 23712 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 440 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 235 ms 860 KB Output is correct
11 Correct 142 ms 860 KB Output is correct
12 Correct 16 ms 856 KB Output is correct
13 Correct 249 ms 856 KB Output is correct
14 Correct 165 ms 860 KB Output is correct
15 Correct 211 ms 984 KB Output is correct
16 Execution timed out 4093 ms 23712 KB Time limit exceeded
17 Halted 0 ms 0 KB -