답안 #770309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
770309 2023-07-01T05:31:56 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
0 / 100
97 ms 19660 KB
#include "werewolf.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[3010], ans;
bitset<6010>vis;
int dfs(int n, int target, int l, int r, int form=0){
    if(vis[3000*form+n]) return 0;
    vis[3000*form+n] = 1;
    if(form&&n>r||!form&&n<l) return 0;
    if(!form&&dfs(n,target,l,r,1))return 1; 
    if(n==target) return 1;
    for(auto i: adj[n])
        if(dfs(i,target,l,r,form))
            return 1;
    return 0;
}
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> ans;
    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<s.size();i++){
        ans.push_back(dfs(s[i],e[i],l[i],r[i]));
    }
    return ans;
}

Compilation message

werewolf.cpp: In function 'int dfs(int, int, int, int, int)':
werewolf.cpp:9:12: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
    9 |     if(form&&n>r||!form&&n<l) return 0;
      |        ~~~~^~~~~
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:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<X.size();i++)
      |                 ~^~~~~~~~~
werewolf.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 97 ms 19660 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -