Submission #340945

# Submission time Handle Problem Language Result Execution time Memory
340945 2020-12-28T15:55:17 Z a_player Werewolf (IOI18_werewolf) C++14
15 / 100
2032 ms 21356 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;
      if(co.s==0&&dp[co.f][1]==-1)q.emplace(co.f,1);
      for(int x:grafo[co.f]){
        if(co.s==0&&dp[x][0]==-1)q.emplace(x,0);
        if(co.s==1&&dp[x][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++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1457 ms 1028 KB Output is correct
11 Correct 920 ms 1004 KB Output is correct
12 Correct 100 ms 748 KB Output is correct
13 Correct 1031 ms 1024 KB Output is correct
14 Correct 475 ms 1004 KB Output is correct
15 Correct 2032 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 168 ms 21356 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1457 ms 1028 KB Output is correct
11 Correct 920 ms 1004 KB Output is correct
12 Correct 100 ms 748 KB Output is correct
13 Correct 1031 ms 1024 KB Output is correct
14 Correct 475 ms 1004 KB Output is correct
15 Correct 2032 ms 1132 KB Output is correct
16 Runtime error 168 ms 21356 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -