답안 #599921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599921 2022-07-20T09:06:09 Z Hanksburger 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 32728 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*2; 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] || v>=n && v<=n+r[i]))
                {
                    ok[v]=1;
                    q.push(v);
                }
            }
        }
        ans.push_back(ok[n+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] || v>=n && v<=n+r[i]))
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 9684 KB Output is correct
2 Correct 7 ms 9696 KB Output is correct
3 Correct 6 ms 9616 KB Output is correct
4 Correct 7 ms 9644 KB Output is correct
5 Correct 5 ms 9700 KB Output is correct
6 Correct 6 ms 9720 KB Output is correct
7 Correct 6 ms 9640 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 6 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 9684 KB Output is correct
2 Correct 7 ms 9696 KB Output is correct
3 Correct 6 ms 9616 KB Output is correct
4 Correct 7 ms 9644 KB Output is correct
5 Correct 5 ms 9700 KB Output is correct
6 Correct 6 ms 9720 KB Output is correct
7 Correct 6 ms 9640 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 6 ms 9684 KB Output is correct
10 Correct 344 ms 10176 KB Output is correct
11 Correct 223 ms 10148 KB Output is correct
12 Correct 18 ms 10092 KB Output is correct
13 Correct 262 ms 10168 KB Output is correct
14 Correct 160 ms 10068 KB Output is correct
15 Correct 209 ms 10280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4094 ms 32728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 9684 KB Output is correct
2 Correct 7 ms 9696 KB Output is correct
3 Correct 6 ms 9616 KB Output is correct
4 Correct 7 ms 9644 KB Output is correct
5 Correct 5 ms 9700 KB Output is correct
6 Correct 6 ms 9720 KB Output is correct
7 Correct 6 ms 9640 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 6 ms 9684 KB Output is correct
10 Correct 344 ms 10176 KB Output is correct
11 Correct 223 ms 10148 KB Output is correct
12 Correct 18 ms 10092 KB Output is correct
13 Correct 262 ms 10168 KB Output is correct
14 Correct 160 ms 10068 KB Output is correct
15 Correct 209 ms 10280 KB Output is correct
16 Execution timed out 4094 ms 32728 KB Time limit exceeded
17 Halted 0 ms 0 KB -