Submission #600597

# Submission time Handle Problem Language Result Execution time Memory
600597 2022-07-21T06:05:36 Z jack715 Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 22772 KB
#include "werewolf.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second

using namespace std;

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);
  vector<int> path[n];
  for (int i = 0; i < x.size(); i++) {
    path[x[i]].pb(y[i]);
    path[y[i]].pb(x[i]);
  }

  queue<int> bfs;
  for (int i = 0; i < Q; i++) {
    vector<int> used(n, 0);
    bfs.push(s[i]), used[s[i]] = 1;
    while (!bfs.empty()) {
      int now = bfs.front();
      bfs.pop();
      for (int next : path[now]) {
        if (used[next] || next < l[i]) continue;
        used[next] = 1;
        bfs.push(next);
      }
    }

    for (int j = l[i]; j <= r[i]; j++) {
      if (used[j]) bfs.push(j);
    }

    // cout << "WAY\n";
    while (!bfs.empty()) {
      int now = bfs.front();
      bfs.pop();
      for (int next : path[now]) {
        if (used[next] || next > r[i]) continue;
        used[next] = 1;
        bfs.push(next);
      }
    }

    // cout << "WUT\n";
    if (used[e[i]] && e[i] <= r[i]) A[i] = 1;
  }
  return A;
}

/*
6 6 3
5 1 
1 2
1 3
3 4
3 0 
5 2
4 2 1 2
4 2 2 2 
5 4 3 4
*/

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:19:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for (int i = 0; i < x.size(); i++) {
      |                   ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 246 ms 744 KB Output is correct
11 Correct 174 ms 724 KB Output is correct
12 Correct 25 ms 732 KB Output is correct
13 Correct 234 ms 744 KB Output is correct
14 Correct 176 ms 716 KB Output is correct
15 Correct 175 ms 824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4098 ms 22772 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 246 ms 744 KB Output is correct
11 Correct 174 ms 724 KB Output is correct
12 Correct 25 ms 732 KB Output is correct
13 Correct 234 ms 744 KB Output is correct
14 Correct 176 ms 716 KB Output is correct
15 Correct 175 ms 824 KB Output is correct
16 Execution timed out 4098 ms 22772 KB Time limit exceeded
17 Halted 0 ms 0 KB -