Submission #1045486

# Submission time Handle Problem Language Result Execution time Memory
1045486 2024-08-06T03:08:30 Z SiliconSquared Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 33740 KB
#include "werewolf.h"
using namespace std;
#include <vector>

struct node{
    int x;
    vector<int> v;
    bool g,h;
    node(){}
};
vector<node> v;
std::vector<int> check_validity(int n, std::vector<int> X, std::vector<int> Y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
    v.resize(n);
    for (int i=0;i<X.size();i++){
        v[X[i]].v.push_back(Y[i]);
        v[Y[i]].v.push_back(X[i]);
    }
    vector<int> q;
    vector<int> z;
    z.resize(S.size());
    int p;
    bool f;
    for (int _=0;_<S.size();_++){
        for (int i=0;i<n;i++){v[i].g=false;v[i].h=false;}
        q.clear();
        q.push_back(S[_]);
        f=false;
        while (!q.empty()){
            p=q[q.size()-1];
            q.pop_back();
            if (v[p].g||p<L[_]){continue;}
            v[p].g=true;
            for (int i:v[p].v){
                q.push_back(i);
            }
        }
        q.clear();
        q.push_back(E[_]);
        while (!q.empty()){
            p=q[q.size()-1];
            q.pop_back();
            if (v[p].h||p>R[_]){continue;}
            if (v[p].g){f=true;break;}
            v[p].h=true;
            for (int i:v[p].v){
                q.push_back(i);
            }
        }
        z[_]=f;
    }
    return z;
}

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:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0;i<X.size();i++){
      |                  ~^~~~~~~~~
werewolf.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int _=0;_<S.size();_++){
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 79 ms 904 KB Output is correct
11 Correct 37 ms 856 KB Output is correct
12 Correct 10 ms 860 KB Output is correct
13 Correct 75 ms 860 KB Output is correct
14 Correct 47 ms 856 KB Output is correct
15 Correct 118 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4014 ms 33740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 79 ms 904 KB Output is correct
11 Correct 37 ms 856 KB Output is correct
12 Correct 10 ms 860 KB Output is correct
13 Correct 75 ms 860 KB Output is correct
14 Correct 47 ms 856 KB Output is correct
15 Correct 118 ms 856 KB Output is correct
16 Execution timed out 4014 ms 33740 KB Time limit exceeded
17 Halted 0 ms 0 KB -