답안 #1009262

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009262 2024-06-27T10:41:36 Z HappyCapybara 늑대인간 (IOI18_werewolf) C++17
0 / 100
4000 ms 38744 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>> g(N);
    for (int i=0; i<X.size(); i++){
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }

    vector<int> A(S.size(), 0);
    for (int i=0; i<S.size(); i++){
        vector<bool> seen(N, false);
        queue<int> q;
        q.push(S[i]);
        unordered_set<int> reach;
        while (!q.empty()){
            int cur = q.front();
            q.pop();
            if (seen[cur]) continue;
            if (cur < L[i]) continue;
            seen[cur] = true;
            reach.insert(cur);
            for (int next : g[cur]) q.push(next);
        }
        for (int j=0; j<seen.size(); j++) seen[i] = false;
        q.push(E[i]);
        while (!q.empty()){
            int cur = q.front();
            q.pop();
            if (seen[cur]) continue;
            if (cur > R[i]) continue;
            seen[cur] = true;
            if (reach.find(cur) != reach.end()){
                A[i] = 1;
                break;
            }
            for (int next : g[cur]) q.push(next);
        }
    }

    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:7:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i=0; i<X.size(); i++){
      |                   ~^~~~~~~~~
werewolf.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i=0; i<S.size(); i++){
      |                   ~^~~~~~~~~
werewolf.cpp:27:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (int j=0; j<seen.size(); j++) seen[i] = false;
      |                       ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4035 ms 38744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -