답안 #1055406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055406 2024-08-12T18:48:08 Z ArthuroWich 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 23560 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) {
    int q = S.size();
    vector<int> a(q);
    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]);
    }
    for (int i = 0; i < q; i++) {
        int l = L[i], r = R[i];
        vector<int> vis(n, 0);
        queue<int> q;
        if (S[i] >= l) {
            q.push(S[i]);
        }
        if (E[i] > r) {
            a[i] = 0;
            continue;
        }
        while(!q.empty()) {
            int a = q.front();
            q.pop();
            if (vis[a]) {
                continue;
            }
            vis[a] = 1;
            for (int b : adj[a]) {
                if (b >= l) {
                    q.push(b);
                }
            }
        }
        for (int i = l; i <= r; i++) {
            if (vis[i]) {
                for (int b : adj[i]) {
                    if (b <= r) {
                        q.push(b);
                    }
                }
            }
        }
        while(!q.empty()) {
            int a = q.front();
            q.pop();
            if (vis[a]) {
                continue;
            }
            vis[a] = 1;
            for (int b : adj[a]) {
                if (b <= r) {
                    q.push(b);
                }
            }
        }
        a[i] = vis[E[i]];
    }
    return a;
}

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:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < X.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 179 ms 860 KB Output is correct
11 Correct 125 ms 880 KB Output is correct
12 Correct 9 ms 860 KB Output is correct
13 Correct 165 ms 892 KB Output is correct
14 Correct 105 ms 880 KB Output is correct
15 Correct 120 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4080 ms 23560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 179 ms 860 KB Output is correct
11 Correct 125 ms 880 KB Output is correct
12 Correct 9 ms 860 KB Output is correct
13 Correct 165 ms 892 KB Output is correct
14 Correct 105 ms 880 KB Output is correct
15 Correct 120 ms 1008 KB Output is correct
16 Execution timed out 4080 ms 23560 KB Time limit exceeded
17 Halted 0 ms 0 KB -