답안 #976658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976658 2024-05-07T00:57:08 Z irmuun 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 30236 KB
#include<bits/stdc++.h>
#include "werewolf.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

vector<int>check_validity(int N,vector<int>X,vector<int>Y,vector<int>S,vector<int>E,vector<int>L,vector<int>R){
    int Q=S.size();
    vector<int>can(Q,0);
    vector<int>adj[N];
    for(int i=0;i<X.size();i++){
        adj[X[i]].pb(Y[i]);
        adj[Y[i]].pb(X[i]);
    }
    vector<bool>human(N),wolf(N);
    for(int i=0;i<Q;i++){
        int s=S[i],e=E[i],l=L[i],r=R[i];
        fill(all(human),0);
        fill(all(wolf),0);
        if(s<l){
            break;
        }
        human[s]=true;
        queue<int>q;
        q.push(s);
        while(!q.empty()){
            int x=q.front();
            q.pop();
            for(int y:adj[x]){
                if(y>=l&&!human[y]){
                    human[y]=true;
                    q.push(y);
                }
            }
        }
        for(int j=l;j<=r;j++){
            if(human[j]){
                wolf[j]=true;
                q.push(j);
            }
        }
        while(!q.empty()){
            int x=q.front();
            q.pop();
            for(int y:adj[x]){
                if(y<=r&&!wolf[y]){
                    wolf[y]=true;
                    q.push(y);
                }
            }
        }
        if(wolf[e]) can[i]=1;
    }
    return can;
}

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:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0;i<X.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 225 ms 856 KB Output is correct
11 Correct 155 ms 856 KB Output is correct
12 Correct 33 ms 852 KB Output is correct
13 Correct 216 ms 864 KB Output is correct
14 Correct 145 ms 856 KB Output is correct
15 Correct 165 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4030 ms 30236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 225 ms 856 KB Output is correct
11 Correct 155 ms 856 KB Output is correct
12 Correct 33 ms 852 KB Output is correct
13 Correct 216 ms 864 KB Output is correct
14 Correct 145 ms 856 KB Output is correct
15 Correct 165 ms 856 KB Output is correct
16 Execution timed out 4030 ms 30236 KB Time limit exceeded
17 Halted 0 ms 0 KB -