답안 #591005

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591005 2022-07-06T17:16:19 Z PiejanVDC 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 29816 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>check_validity(int n, vector<int>x, vector<int>y, vector<int>s, vector<int>e, vector<int>l, vector<int>r) {
    const int m = (int)x.size();
    const int q = (int)s.size();

    vector<int>ans(q, 0);

    vector<int>adj[n];

    for(int i = 0 ; i < m ; i++) {
        adj[x[i]].push_back(y[i]);
        adj[y[i]].push_back(x[i]);
    }

    for(int i = 0 ; i < q ; i++) {
        
        vector<bool>vis(n, 0);
        int S = s[i], E = e[i];
        int L = l[i], R = r[i];

        queue<int>Q;
        Q.push(S);

        vis[S] = 1;

        // check start

        if(S < L) 
            continue;

        while(!Q.empty()) {
            int node = Q.front();
            Q.pop();
            for(auto z : adj[node]) if(!vis[z] && z >= L) {
                vis[z] = 1;
                Q.push(z);
            }
        }

        vector<bool>viss(n, 0);
        viss[E] = 1;

        if(E > R)
            continue;

        Q.push(E);
        while(!Q.empty()) {
            int node = Q.front();
            Q.pop();
            if(vis[node]) {
                ans[i] = 1;
                break;
            }
            for(auto z : adj[node]) if(!viss[z] && z <= R) {
                viss[z] = 1;
                Q.push(z);
            }
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 144 ms 708 KB Output is correct
11 Correct 86 ms 696 KB Output is correct
12 Correct 11 ms 696 KB Output is correct
13 Correct 134 ms 724 KB Output is correct
14 Correct 88 ms 704 KB Output is correct
15 Correct 170 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4058 ms 29816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 144 ms 708 KB Output is correct
11 Correct 86 ms 696 KB Output is correct
12 Correct 11 ms 696 KB Output is correct
13 Correct 134 ms 724 KB Output is correct
14 Correct 88 ms 704 KB Output is correct
15 Correct 170 ms 724 KB Output is correct
16 Execution timed out 4058 ms 29816 KB Time limit exceeded
17 Halted 0 ms 0 KB -