Submission #770311

# Submission time Handle Problem Language Result Execution time Memory
770311 2023-07-01T05:32:40 Z boyliguanhan Werewolf (IOI18_werewolf) C++17
15 / 100
191 ms 19548 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++){
        vis.reset();
        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++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 368 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 368 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 368 KB Output is correct
10 Correct 100 ms 748 KB Output is correct
11 Correct 75 ms 720 KB Output is correct
12 Correct 9 ms 900 KB Output is correct
13 Correct 85 ms 884 KB Output is correct
14 Correct 69 ms 708 KB Output is correct
15 Correct 191 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 92 ms 19548 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 368 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 368 KB Output is correct
10 Correct 100 ms 748 KB Output is correct
11 Correct 75 ms 720 KB Output is correct
12 Correct 9 ms 900 KB Output is correct
13 Correct 85 ms 884 KB Output is correct
14 Correct 69 ms 708 KB Output is correct
15 Correct 191 ms 860 KB Output is correct
16 Runtime error 92 ms 19548 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -