답안 #340944

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
340944 2020-12-28T15:49:46 Z a_player 늑대인간 (IOI18_werewolf) C++14
0 / 100
193 ms 29548 KB
#include "werewolf.h"
#include <bits/stdc++.h>
#ifdef ALE
#include "grader.cpp"
#endif
#define f first
#define s second

using namespace std;

const int nax=3e3+3;

vector<int> grafo[nax];
int dp[nax][2];
queue<pair<int,bool> > 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) {
  int Q = S.size();
  vector<int> A(Q);
  for(int i=0;i<X.size();i++){
    grafo[X[i]].push_back(Y[i]);
    grafo[Y[i]].push_back(X[i]);
  }
  for(int i=0;i<Q;i++){
    memset(dp,-1,sizeof(dp));
    q.emplace(S[i],0);
    while(!q.empty()){
      auto co=q.front();
      q.pop();
      if(!co.s&&co.f<L[i]){
        dp[co.f][co.s]=0;
        continue;
      }
      if(co.s&&co.f>R[i]){
        dp[co.f][co.s]=0;
        continue;
      }
      dp[co.f][co.s]=1;
      for(int x:grafo[co.f]){
        if(co.s==0&&dp[x][0]==-1)q.emplace(x,0);
        if(dp[i][1]==-1)q.emplace(x,1);
      }
    }
    A[i]=(dp[E[i]][1]==1);
  }
  return A;
}

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:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for(int i=0;i<X.size();i++){
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 193 ms 29548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 748 KB Output isn't correct
2 Halted 0 ms 0 KB -