Submission #1009276

# Submission time Handle Problem Language Result Execution time Memory
1009276 2024-06-27T10:50:27 Z HappyCapybara Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 31100 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 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 604 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 604 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 348 KB Output is correct
10 Correct 359 ms 1000 KB Output is correct
11 Correct 257 ms 1016 KB Output is correct
12 Correct 29 ms 856 KB Output is correct
13 Correct 236 ms 856 KB Output is correct
14 Correct 107 ms 992 KB Output is correct
15 Correct 345 ms 1072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4067 ms 31100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 604 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 348 KB Output is correct
10 Correct 359 ms 1000 KB Output is correct
11 Correct 257 ms 1016 KB Output is correct
12 Correct 29 ms 856 KB Output is correct
13 Correct 236 ms 856 KB Output is correct
14 Correct 107 ms 992 KB Output is correct
15 Correct 345 ms 1072 KB Output is correct
16 Execution timed out 4067 ms 31100 KB Time limit exceeded
17 Halted 0 ms 0 KB -