Submission #517084

# Submission time Handle Problem Language Result Execution time Memory
517084 2022-01-22T13:42:08 Z Ai7081 Stations (IOI20_stations) C++17
0 / 100
3 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;

int cnt, cnt2;
vector<int> ret;
vector<vector<int>> adj;

void dfs(int v, int p) {
    ret[v] = 1000*cnt2 + cnt;
    //cout << v << ' ' << ret[v] << endl;
    cnt2++;
    for (auto to : adj[v]) {
        if (to != p) {
            dfs(to, v);
        }
    }
    return;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    adj.assign(n, vector<int>());
    for (int i=0; i<(int)u.size(); i++) {
        adj[u[i]].push_back(v[i]);
        adj[v[i]].push_back(u[i]);
    }
    for (int i=0; i<n; i++) {
        if (adj[i].size() > 2) {
            ret.assign(n, 0);
            ret[i] = 0;
            cnt = 1;
            for (auto x : adj[i]) {
                cnt2 = 0;
                dfs(x, i);
                cnt++;
            }
            break;
        }
    }
    return ret;
}

int find_next_station(int s, int t, vector<int> c) {
    if (!s) return t % 1000;
    if (s%1000 != t%1000) return s - 1000;
    if (t > s) return s + 1000;
    return s - 1000;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Invalid length of array as the response of 'label'. scenario=0, n=10, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=1001
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=0, n=3, len=0
2 Halted 0 ms 0 KB -