Submission #1018332

# Submission time Handle Problem Language Result Execution time Memory
1018332 2024-07-09T19:07:12 Z vjudge1 Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 32508 KB
#include "werewolf.h"
#include<iostream>
#include<vector>
using namespace std;

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

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=0;j<N;j++)v[j]=0;
        dfs1(S[i],L[i]);
        for(int j=0;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++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5720 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5724 KB Output is correct
8 Correct 1 ms 5724 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5720 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5724 KB Output is correct
8 Correct 1 ms 5724 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
10 Correct 183 ms 6204 KB Output is correct
11 Correct 110 ms 6264 KB Output is correct
12 Correct 17 ms 6236 KB Output is correct
13 Correct 158 ms 6296 KB Output is correct
14 Correct 75 ms 6236 KB Output is correct
15 Correct 169 ms 6416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4096 ms 32508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5720 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5724 KB Output is correct
8 Correct 1 ms 5724 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
10 Correct 183 ms 6204 KB Output is correct
11 Correct 110 ms 6264 KB Output is correct
12 Correct 17 ms 6236 KB Output is correct
13 Correct 158 ms 6296 KB Output is correct
14 Correct 75 ms 6236 KB Output is correct
15 Correct 169 ms 6416 KB Output is correct
16 Execution timed out 4096 ms 32508 KB Time limit exceeded
17 Halted 0 ms 0 KB -