Submission #778821

# Submission time Handle Problem Language Result Execution time Memory
778821 2023-07-10T18:22:41 Z benjaminkleyn Werewolf (IOI18_werewolf) C++17
0 / 100
4000 ms 29832 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int par1[200000], par2[200000];
int find1(int u) { return par1[u] == u ? u : find1(par1[u]); }
int find2(int u) { return par2[u] == u ? u : find2(par2[u]); }
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(), M = X.size();
    vector<int> A(Q, 0);

    vector<vector<int>> g(N);
    for (int i = 0; i < M; i++)
    {
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }

    for (int u = 0; u < N; u++)
        for (int v : g[u])
            if (v < u)
                par1[find1(v)] = u;
    for (int u = N - 1; u >= 0; u--)
        for (int v : g[u])
            if (v > u)
                par2[find2(v)] = u;
    return A;
}

# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 29832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -