Submission #1032569

# Submission time Handle Problem Language Result Execution time Memory
1032569 2024-07-24T03:01:25 Z HappyCapybara Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 39740 KB
#include "werewolf.h"
#include<bits/stdc++.h>
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){
    vector<vector<int>> g(N);
    for (int i=0; i<X.size(); i++){
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }

    vector<int> A(S.size(), 0);
    for (int i=0; i<S.size(); i++){
        vector<bool> seen(N, false);
        queue<int> q;
        q.push(S[i]);
        unordered_set<int> reach;
        while (!q.empty()){
            int cur = q.front();
            q.pop();
            if (seen[cur]) continue;
            if (cur < L[i]) continue;
            seen[cur] = true;
            reach.insert(cur);
            for (int next : g[cur]) q.push(next);
        }
        for (int j=0; j<seen.size(); j++) seen[j] = false;
        q.push(E[i]);
        while (!q.empty()){
            int cur = q.front();
            q.pop();
            if (seen[cur]) continue;
            if (cur > R[i]) continue;
            seen[cur] = true;
            if (reach.find(cur) != reach.end()){
                A[i] = 1;
                break;
            }
            for (int next : g[cur]) q.push(next);
        }
    }

    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:7:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i=0; i<X.size(); i++){
      |                   ~^~~~~~~~~
werewolf.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i=0; i<S.size(); i++){
      |                   ~^~~~~~~~~
werewolf.cpp:27:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (int j=0; j<seen.size(); j++) seen[j] = false;
      |                       ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 412 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 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 412 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 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 373 ms 860 KB Output is correct
11 Correct 232 ms 860 KB Output is correct
12 Correct 23 ms 856 KB Output is correct
13 Correct 214 ms 868 KB Output is correct
14 Correct 114 ms 856 KB Output is correct
15 Correct 329 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4037 ms 39740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 412 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 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 373 ms 860 KB Output is correct
11 Correct 232 ms 860 KB Output is correct
12 Correct 23 ms 856 KB Output is correct
13 Correct 214 ms 868 KB Output is correct
14 Correct 114 ms 856 KB Output is correct
15 Correct 329 ms 856 KB Output is correct
16 Execution timed out 4037 ms 39740 KB Time limit exceeded
17 Halted 0 ms 0 KB -