답안 #763175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763175 2023-06-22T05:38:51 Z t6twotwo 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 30308 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
    vector<vector<int>> adj(N);
    for (int i = 0; i < X.size(); i++) {
        adj[X[i]].push_back(Y[i]);
        adj[Y[i]].push_back(X[i]);
    }
    int Q = S.size();
    vector<int> ans(Q);
    for (int i = 0; i < Q; i++) {
        bool vis[N][2]{};
        vis[S[i]][0] = 1;
        queue<pair<int, int>> q;
        q.emplace(S[i], 0);
        while (!q.empty()) {
            auto [x, z] = q.front();
            q.pop();
            if (z == 0 && x <= R[i] && !vis[x][1]) {
                vis[x][1] = 1;
                q.emplace(x, 1);
            }
            for (int y : adj[x]) {
                if (z == 0) {
                    if (y >= L[i] && !vis[y][0]) {
                        vis[y][0] = 1;
                        q.emplace(y, 0);
                    }
                } else {
                    if (y <= R[i] && !vis[y][1]) {
                        vis[y][1] = 1;
                        q.emplace(y, 1);
                    }
                }
            }
        }
        ans[i] = vis[E[i]][1];
    }
    return ans;
}

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:6:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     for (int i = 0; i < X.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 277 ms 724 KB Output is correct
11 Correct 177 ms 724 KB Output is correct
12 Correct 11 ms 724 KB Output is correct
13 Correct 230 ms 736 KB Output is correct
14 Correct 145 ms 724 KB Output is correct
15 Correct 187 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4050 ms 30308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 277 ms 724 KB Output is correct
11 Correct 177 ms 724 KB Output is correct
12 Correct 11 ms 724 KB Output is correct
13 Correct 230 ms 736 KB Output is correct
14 Correct 145 ms 724 KB Output is correct
15 Correct 187 ms 844 KB Output is correct
16 Execution timed out 4050 ms 30308 KB Time limit exceeded
17 Halted 0 ms 0 KB -