답안 #1038531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038531 2024-07-29T22:28:30 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
15 / 100
175 ms 32712 KB
#include "werewolf.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100100];
bitset<100100> i_could1,i_could2;
int l,r;

void dfs_h(int n){
  if(n<l)return;
  if(i_could1[n])return;
  i_could1[n]=1;
  for(auto i:adj[n])
    dfs_h(i);
}
void dfs_w(int n){
  if(n>r)return;
  if(i_could2[n])return;
  i_could2[n]=1;
  for(auto i:adj[n])
    dfs_w(i);
}
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) {
  for(int i=0;i<X.size();i++)
    adj[X[i]].push_back(Y[i]),
    adj[Y[i]].push_back(X[i]);
  int Q = S.size();
  std::vector<int> A(Q);
  for (int i = 0; i < Q; ++i) {
    i_could1.reset();
    i_could2.reset();
    l=L[i],r=R[i];
    dfs_h(S[i]);
    dfs_w(E[i]);
    for(int j=l;j<=r;j++)
      A[i]|=i_could1[j]&i_could2[j];
  }
  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:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for(int i=0;i<X.size();i++)
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2732 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2732 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 158 ms 3164 KB Output is correct
11 Correct 56 ms 3152 KB Output is correct
12 Correct 15 ms 3164 KB Output is correct
13 Correct 165 ms 3168 KB Output is correct
14 Correct 80 ms 3164 KB Output is correct
15 Correct 175 ms 3296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 90 ms 32712 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2732 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 158 ms 3164 KB Output is correct
11 Correct 56 ms 3152 KB Output is correct
12 Correct 15 ms 3164 KB Output is correct
13 Correct 165 ms 3168 KB Output is correct
14 Correct 80 ms 3164 KB Output is correct
15 Correct 175 ms 3296 KB Output is correct
16 Runtime error 90 ms 32712 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -