Submission #777123

#TimeUsernameProblemLanguageResultExecution timeMemory
777123welleyth늑대인간 (IOI18_werewolf)C++17
15 / 100
4075 ms29852 KiB
#include "werewolf.h"
#include <bits/stdc++.h>


using namespace std;

constexpr int N = (int)2e5+11;

vector<int> g[N];

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++){
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }

    int q = S.size();
    int n = N;
    bool can[2][n+1];
    vector<int> ans;

    for(int i = 0; i < q; i++){
        memset(can,0,sizeof can);
        queue<int> q;
        q.push(S[i]);
        can[0][S[i]] = 1;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(auto& to : g[v]){
                if(!can[0][to] && to >= L[i]){
                    can[0][to] = 1;
                    q.push(to);
                }
            }
        }
        q.push(E[i]);
        can[1][E[i]] = 1;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(auto& to : g[v]){
                if(!can[1][to] && to <= R[i]){
                    can[1][to] = 1;
                    q.push(to);
                }
            }
        }
        bool ok = false;
        for(int j = L[i]; j <= R[i]; j++)
            ok |= can[0][j] && can[1][j];
        ans.push_back(ok);
    }

    return ans;
}

Compilation message (stderr)

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:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < X.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...