답안 #599916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599916 2022-07-20T08:46:59 Z Hanksburger 늑대인간 (IOI18_werewolf) C++17
0 / 100
4000 ms 33948 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[400005], ans;
bool ok[400005];
queue<int> q;
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++)
    {
        adj[x[i]].push_back(y[i]);
        adj[y[i]].push_back(x[i]);
        adj[n+x[i]].push_back(n+y[i]);
        adj[n+y[i]].push_back(n+x[i]);
    }
    for (int i=0; i<n; i++)
        adj[i].push_back(n+i);
    for (int i=0; i<s.size(); i++)
    {
        for (int j=0; j<n; j++)
            ok[j]=0;
        ok[s[i]]=1;
        q.push(s[i]);
        while (!q.empty())
        {
            int u=q.front();
            q.pop();
            for (int v:adj[u])
            {
                if (!ok[v] && (v<n && v>=l[i] || u>=n && v<=r[i] || u<n && v>=n))
                {
                    ok[v]=1;
                    q.push(v);
                }
            }
        }
        ans.push_back(ok[e[i]]);
    }
    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:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i=0; i<x.size(); i++)
      |                   ~^~~~~~~~~
werewolf.cpp:18:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i=0; i<s.size(); i++)
      |                   ~^~~~~~~~~
werewolf.cpp:30:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   30 |                 if (!ok[v] && (v<n && v>=l[i] || u>=n && v<=r[i] || u<n && v>=n))
werewolf.cpp:30:73: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   30 |                 if (!ok[v] && (v<n && v>=l[i] || u>=n && v<=r[i] || u<n && v>=n))
      |                                                                     ~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 9684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 9684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4049 ms 33948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 9684 KB Output isn't correct
2 Halted 0 ms 0 KB -