답안 #251538

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251538 2020-07-21T18:40:12 Z abacaba Pipes (BOI13_pipes) C++14
18.1481 / 100
239 ms 46072 KB
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <typename T> inline T range(T l, T r) {
    return uniform_int_distribution<T>(l, r)(rng);
}
 
inline void setin(string s) {
    freopen(s.c_str(), "r", stdin);
}
 
inline void setout(string s) {
    freopen(s.c_str(), "w", stdout);
}
 
template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const int mod = 1e9 + 7;
const int inf = 2e9;
const int N = 5e5 + 15;
int n, m, a[N];
vector <int> g[N];
int d[N];
bool used[N];

void precheck(int v, int p = -1) {
    used[v] = true;
    for(int to : g[v]) {
        if(to == p)
            continue;
        if(used[to]) {
            if(d[to] > d[v])
                continue;
            if((d[v] - d[to]) & 1) {
                cout << 0 << endl;
                exit(0);
            }
        }
        else {
            d[to] = d[v] + 1;
            precheck(to, v);
        }
    }
}

main() {
    ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
    // setin("input.txt");
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];
    for(int i = 1; i <= m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    precheck(1);
    assert(0);
    return 0;
}

Compilation message

pipes.cpp:89:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 24312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 22 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 24 ms 24440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 79 ms 34168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 22 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 24 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 20 ms 24316 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 20 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 21 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 24 ms 24440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 21 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 22 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 65 ms 32248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 72 ms 33656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 83 ms 34296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 78 ms 32760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 79 ms 34168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 84 ms 34296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 107 ms 40440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 20 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 20 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 93 ms 34424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 62 ms 32248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 78 ms 34296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 70 ms 32632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 23 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 21 ms 24568 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Correct 74 ms 20216 KB Output is correct
4 Runtime error 115 ms 43644 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 79 ms 34168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Correct 239 ms 27000 KB Output is correct
7 Runtime error 24 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 20 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Correct 9 ms 12160 KB Output is correct
10 Runtime error 25 ms 24312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 20 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 24 ms 24312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Correct 8 ms 12160 KB Output is correct
14 Runtime error 21 ms 24320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 25 ms 24440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 21 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Correct 8 ms 12160 KB Output is correct
18 Runtime error 25 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 21 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 21 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Correct 10 ms 12160 KB Output is correct
22 Runtime error 24 ms 24440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 85 ms 38776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 89 ms 40824 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Correct 58 ms 20216 KB Output is correct
26 Runtime error 91 ms 42360 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 105 ms 43256 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 87 ms 34396 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Correct 198 ms 24312 KB Output is correct
30 Runtime error 108 ms 44920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 107 ms 45048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 105 ms 36472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Correct 77 ms 21112 KB Output is correct
34 Runtime error 96 ms 41336 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 114 ms 43640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 105 ms 34168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Correct 230 ms 26872 KB Output is correct
38 Runtime error 91 ms 43384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 81 ms 35448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 99 ms 40440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Correct 68 ms 23160 KB Output is correct
42 Runtime error 108 ms 42080 KB Execution killed with signal 11 (could be triggered by violating memory limits)
43 Runtime error 96 ms 44408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
44 Runtime error 83 ms 34168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
45 Correct 181 ms 24312 KB Output is correct
46 Runtime error 118 ms 46072 KB Execution killed with signal 11 (could be triggered by violating memory limits)
47 Runtime error 108 ms 40440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
48 Runtime error 108 ms 44920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
49 Correct 56 ms 18296 KB Output is correct
50 Runtime error 92 ms 41336 KB Execution killed with signal 11 (could be triggered by violating memory limits)
51 Runtime error 84 ms 38136 KB Execution killed with signal 11 (could be triggered by violating memory limits)
52 Runtime error 92 ms 37144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
53 Correct 217 ms 24840 KB Output is correct
54 Runtime error 92 ms 42360 KB Execution killed with signal 11 (could be triggered by violating memory limits)