답안 #1018309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018309 2024-07-09T18:46:35 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
0 / 100
4000 ms 27004 KB
#include "werewolf.h"
#include<iostream>
#include<vector>
using namespace std;

vector<int>ad[200001],v(200001);

void dfs1(int u,int l){
    if(u<l||v[u])return;
    v[u]=1;
    for(auto h:ad[u])dfs1(h,l);
}

void dfs2(int u,int r){
    if(r<u||v[u]==2)return;
    v[u]=2;
    for(auto h:ad[u])dfs2(h,r);
}

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<int>A;
    for(int i=0;i<X.size();i++){
        ad[X[i]].push_back(Y[i]);
        ad[Y[i]].push_back(X[i]);
    }
    for(int i=0;i<S.size();i++){
        for(int j=1;j<=N;j++)v[j]=0;
        v[S[i]]=0;
        dfs1(S[i],L[i]);
        for(int j=1;j<=N;j++)
            if(v[j]==1)dfs2(j,R[i]);
        if(v[E[i]]==2)A.push_back(1);
        else A.push_back(0);
    }
    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:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<X.size();i++){
      |                 ~^~~~~~~~~
werewolf.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<S.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4054 ms 27004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB Output isn't correct
3 Halted 0 ms 0 KB -