답안 #777123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
777123 2023-07-08T17:21:43 Z welleyth 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 29852 KB
#include "werewolf.h"
#include <bits/stdc++.h>


using namespace std;

constexpr int N = (int)2e5+11;

vector<int> g[N];

vector<int> check_validity(int N,vector<int> X,vector<int> Y,vector<int> S,vector<int> E,vector<int> L,vector<int> R){
    for(int i = 0; i < X.size(); i++){
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }

    int q = S.size();
    int n = N;
    bool can[2][n+1];
    vector<int> ans;

    for(int i = 0; i < q; i++){
        memset(can,0,sizeof can);
        queue<int> q;
        q.push(S[i]);
        can[0][S[i]] = 1;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(auto& to : g[v]){
                if(!can[0][to] && to >= L[i]){
                    can[0][to] = 1;
                    q.push(to);
                }
            }
        }
        q.push(E[i]);
        can[1][E[i]] = 1;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(auto& to : g[v]){
                if(!can[1][to] && to <= R[i]){
                    can[1][to] = 1;
                    q.push(to);
                }
            }
        }
        bool ok = false;
        for(int j = L[i]; j <= R[i]; j++)
            ok |= can[0][j] && can[1][j];
        ans.push_back(ok);
    }

    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:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < X.size(); i++){
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5008 KB Output is correct
2 Correct 4 ms 4996 KB Output is correct
3 Correct 4 ms 5004 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 5000 KB Output is correct
6 Correct 4 ms 4996 KB Output is correct
7 Correct 4 ms 5000 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5008 KB Output is correct
2 Correct 4 ms 4996 KB Output is correct
3 Correct 4 ms 5004 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 5000 KB Output is correct
6 Correct 4 ms 4996 KB Output is correct
7 Correct 4 ms 5000 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4984 KB Output is correct
10 Correct 201 ms 5480 KB Output is correct
11 Correct 107 ms 5352 KB Output is correct
12 Correct 16 ms 5332 KB Output is correct
13 Correct 216 ms 5376 KB Output is correct
14 Correct 130 ms 5356 KB Output is correct
15 Correct 180 ms 5452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4075 ms 29852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5008 KB Output is correct
2 Correct 4 ms 4996 KB Output is correct
3 Correct 4 ms 5004 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 5000 KB Output is correct
6 Correct 4 ms 4996 KB Output is correct
7 Correct 4 ms 5000 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4984 KB Output is correct
10 Correct 201 ms 5480 KB Output is correct
11 Correct 107 ms 5352 KB Output is correct
12 Correct 16 ms 5332 KB Output is correct
13 Correct 216 ms 5376 KB Output is correct
14 Correct 130 ms 5356 KB Output is correct
15 Correct 180 ms 5452 KB Output is correct
16 Execution timed out 4075 ms 29852 KB Time limit exceeded
17 Halted 0 ms 0 KB -