Submission #729534

# Submission time Handle Problem Language Result Execution time Memory
729534 2023-04-24T08:47:04 Z t6twotwo Werewolf (IOI18_werewolf) C++17
7 / 100
4000 ms 31476 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) {
    int M = X.size();
    int Q = S.size();
    vector<vector<int>> adj(N);
    for (int i = 0; i < M; i++) {
        adj[X[i]].push_back(Y[i]);
        adj[Y[i]].push_back(X[i]);
    }
    vector<int> ans(Q);
    for (int i = 0; i < Q; i++) {
        if (S[i] < L[i] || R[i] < E[i]) {
            continue;
        }
        vector<int> hi(N, -1);
        priority_queue<pair<int, int>> p;
        p.emplace(S[i], S[i]);
        while (!p.empty()) {
            auto [v, x] = p.top();
            p.pop();
            if (hi[x] != -1) {
                continue;
            }
            hi[x] = v;
            for (int y : adj[x]) {
                p.emplace(min(v, y), y);
            }
        }
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
        for (int j = L[i]; j <= R[i]; j++) {
            if (hi[j] >= L[i]) {
                q.emplace(j, j);
            }
        }
        vector<int> lo(N, N);
        while (!q.empty()) {
            auto [v, x] = q.top();
            q.pop();
            if (lo[x] != N) {
                continue;
            }
            lo[x] = v;
            for (int y : adj[x]) {
                q.emplace(max(v, y), y);
            }
        }
        if (lo[E[i]] <= R[i]) {
            ans[i] = 1;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 7 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 5 ms 308 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 7 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 5 ms 308 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 3948 ms 796 KB Output is correct
11 Correct 3212 ms 780 KB Output is correct
12 Correct 1431 ms 784 KB Output is correct
13 Correct 3392 ms 908 KB Output is correct
14 Correct 2454 ms 788 KB Output is correct
15 Execution timed out 4040 ms 1004 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4048 ms 31476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 7 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 5 ms 308 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 3948 ms 796 KB Output is correct
11 Correct 3212 ms 780 KB Output is correct
12 Correct 1431 ms 784 KB Output is correct
13 Correct 3392 ms 908 KB Output is correct
14 Correct 2454 ms 788 KB Output is correct
15 Execution timed out 4040 ms 1004 KB Time limit exceeded
16 Halted 0 ms 0 KB -