Submission #1066920

# Submission time Handle Problem Language Result Execution time Memory
1066920 2024-08-20T08:47:23 Z Muhammad_Aneeq Werewolf (IOI18_werewolf) C++17
7 / 100
4000 ms 30328 KB
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
int const N=2e5+10;
vector<int>nei[N]={};
bool reach[N]={};
bool bfs(int u,int v,int l,int r)
{
    queue<pair<int,int>>Q;
    Q.push({0,u});
    reach[u]=1;
    while (Q.size())
    {
        int city,form;
        tie(form,city)=Q.front();
        Q.pop();
        for (auto j:nei[city])
        {
            if (city<l&&j>r)
                continue;
            if (city>r&&j<l)
                continue;
            if (reach[j])
                continue;
            if (j>r&&form==1)
                continue;
            if (j<l)
                Q.push({1,j});
            else if (j>r)
                Q.push({0,j});
            else
                Q.push({form,j});
            reach[j]=1;
        }
    }
    return reach[v];
}
vector<int> check_validity(int N, vector<int> X, vector<int> Y,vector<int> S, vector<int> E,vector<int> L, vector<int> R)
{
    for (int i=0;i<X.size();i++)
    {
        nei[X[i]].push_back(Y[i]);
        nei[Y[i]].push_back(X[i]);
    }
    vector<int>ans;
    for (int i=0;i<S.size();i++)
    {
        ans.push_back(bfs(S[i],E[i],L[i],R[i]));
        for (int j=0;j<N;j++)
            reach[j]=0;
    }
    return ans;
}

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:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i=0;i<X.size();i++)
      |                  ~^~~~~~~~~
werewolf.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for (int i=0;i<S.size();i++)
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5212 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Correct 1 ms 4956 KB Output is correct
4 Correct 1 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 1 ms 5040 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 5160 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5212 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Correct 1 ms 4956 KB Output is correct
4 Correct 1 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 1 ms 5040 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 5160 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Incorrect 192 ms 5512 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3614 ms 30328 KB Output is correct
2 Execution timed out 4065 ms 29416 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5212 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Correct 1 ms 4956 KB Output is correct
4 Correct 1 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 1 ms 5040 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 5160 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Incorrect 192 ms 5512 KB Output isn't correct
11 Halted 0 ms 0 KB -