Submission #730793

# Submission time Handle Problem Language Result Execution time Memory
730793 2023-04-26T12:12:49 Z PoonYaPat Werewolf (IOI18_werewolf) C++14
15 / 100
286 ms 19668 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> adj[3001];
bool vis1[3001],vis2[3001];

vector<int> check_validity(int n, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, 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]);
    }
    vector<int> Ans;
    for (int i=0; i<S.size(); ++i) {
        queue<int> q;
        memset(vis1,0,sizeof(vis1));
        memset(vis2,0,sizeof(vis2));

        if (S[i]>=L[i]) q.push(S[i]);
        while (!q.empty()) {
            int node=q.front();
            q.pop();

            if (vis1[node]) continue;
            vis1[node]=true;

            for (auto s : adj[node]) {
                if (s>=L[i]) q.push(s);
            }
        }

        if (E[i]<=R[i]) q.push(E[i]);
        while (!q.empty()) {
            int node=q.front();
            q.pop();

            if (vis2[node]) continue;
            vis2[node]=true;

            for (auto s : adj[node]) {
                if (s<=R[i]) q.push(s);
            }
        }

        int ans=0;
        for (int i=0; i<n; ++i) if (vis1[i]==true && vis2[i]==true) ans=1;
        Ans.push_back(ans);
    }
    return Ans;
}

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:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i=0; i<X.size(); ++i) {
      |                   ~^~~~~~~~~
werewolf.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i=0; i<S.size(); ++i) {
      |                   ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 380 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 380 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 266 ms 724 KB Output is correct
11 Correct 163 ms 712 KB Output is correct
12 Correct 16 ms 724 KB Output is correct
13 Correct 286 ms 716 KB Output is correct
14 Correct 204 ms 740 KB Output is correct
15 Correct 233 ms 772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 121 ms 19668 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 380 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 266 ms 724 KB Output is correct
11 Correct 163 ms 712 KB Output is correct
12 Correct 16 ms 724 KB Output is correct
13 Correct 286 ms 716 KB Output is correct
14 Correct 204 ms 740 KB Output is correct
15 Correct 233 ms 772 KB Output is correct
16 Runtime error 121 ms 19668 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -