답안 #938134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938134 2024-03-04T21:56:43 Z PagodePaiva 늑대인간 (IOI18_werewolf) C++17
15 / 100
231 ms 19800 KB
#include "werewolf.h"
#include<bits/stdc++.h>
#define N 3010

using namespace std;

int lt, rt;
int mark[N][2];
vector <int> g[N];

void dfs(int node, int typ){
  if(mark[node][typ]) return;
  mark[node][typ] = 1;
  if(lt <= node and node <= rt and typ == 0) dfs(node, 1);
  for(auto x : g[node]){
    if(typ == 0){
      if(x < lt) continue;
      dfs(x, typ);
    }
    else{
      if(x > rt) continue;
      dfs(x, typ);
    }
  }
  return;
}

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++){
    int a = ++x[i], b = ++y[i];
    g[a].push_back(b);
    g[b].push_back(a);
  }  
  vector <int> res;
  for(int i = 0;i < s.size();i++){
    int st = ++s[i], ed = ++e[i]; lt = ++l[i]; rt = ++ r[i];
    memset(mark, 0, sizeof mark);
    dfs(st, 0);
    res.push_back(mark[ed][1]);
  }
  return res;
}

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:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int i = 0;i < x.size();i++){
      |                 ~~^~~~~~~~~~
werewolf.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i = 0;i < s.size();i++){
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 516 KB Output is correct
10 Correct 231 ms 888 KB Output is correct
11 Correct 143 ms 860 KB Output is correct
12 Correct 11 ms 856 KB Output is correct
13 Correct 208 ms 860 KB Output is correct
14 Correct 134 ms 860 KB Output is correct
15 Correct 172 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 92 ms 19800 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 516 KB Output is correct
10 Correct 231 ms 888 KB Output is correct
11 Correct 143 ms 860 KB Output is correct
12 Correct 11 ms 856 KB Output is correct
13 Correct 208 ms 860 KB Output is correct
14 Correct 134 ms 860 KB Output is correct
15 Correct 172 ms 860 KB Output is correct
16 Runtime error 92 ms 19800 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -