Submission #580797

#TimeUsernameProblemLanguageResultExecution timeMemory
580797definitelynotmee늑대인간 (IOI18_werewolf)C++17
15 / 100
4038 ms26500 KiB
#include "werewolf.h"
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
using matrix = vector<vector<T>>;

std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
    
    matrix<int> g(N);
    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();
    std::vector<int> ans(Q);
    vector<int> c1(N), c2(N);
    auto dfs =[&](int id, int l, int r,vector<int>&check, auto dfs)->void{
        check[id] = 1;
        for(int i : g[id]){
            if(check[i] || i > r || i < l)
                continue;
            dfs(i,l,r,check,dfs);
        }
    };

    for(int i = 0; i < Q; i++){
        fill(all(c1),0);
        fill(all(c2),0);
        dfs(S[i],L[i],N,c1,dfs);
        dfs(E[i],0,R[i],c2,dfs);
        for(int j = 0; j < N; j++){
            ans[i]|=c1[j]&&c2[j];
        }
    }
    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:18:22: 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 < 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...