Submission #517052

# Submission time Handle Problem Language Result Execution time Memory
517052 2022-01-22T12:51:34 Z Ai7081 Stations (IOI20_stations) C++17
5 / 100
902 ms 624 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;

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

void dfs1(int v, int p) {
    ret[v] = cnt++;
    for (auto to : adj[v]) {
        if (to != p) {
            dfs1(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() == 1) {
            ret.assign(n, 0);
            cnt = 0;
            dfs1(i, i);
            return ret;
        }
    }
}

int find_next_station(int s, int t, vector<int> c) {
    return (s < t) ? s+1 : s-1;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 495 ms 620 KB Output is correct
2 Correct 455 ms 520 KB Output is correct
3 Correct 902 ms 468 KB Output is correct
4 Correct 648 ms 404 KB Output is correct
5 Correct 500 ms 400 KB Output is correct
6 Correct 377 ms 480 KB Output is correct
7 Correct 426 ms 520 KB Output is correct
8 Correct 3 ms 532 KB Output is correct
9 Correct 3 ms 476 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 424 ms 528 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 422 ms 528 KB Output is correct
2 Correct 412 ms 592 KB Output is correct
3 Correct 812 ms 476 KB Output is correct
4 Correct 579 ms 400 KB Output is correct
5 Correct 574 ms 404 KB Output is correct
6 Correct 432 ms 480 KB Output is correct
7 Correct 411 ms 528 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 4 ms 476 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Incorrect 522 ms 532 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 787 ms 404 KB Output is correct
2 Correct 651 ms 484 KB Output is correct
3 Correct 602 ms 464 KB Output is correct
4 Correct 3 ms 576 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Incorrect 551 ms 532 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 477 ms 624 KB Output is correct
2 Correct 477 ms 608 KB Output is correct
3 Correct 828 ms 464 KB Output is correct
4 Correct 615 ms 464 KB Output is correct
5 Correct 479 ms 404 KB Output is correct
6 Correct 473 ms 596 KB Output is correct
7 Correct 433 ms 468 KB Output is correct
8 Correct 3 ms 404 KB Output is correct
9 Correct 4 ms 604 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 489 ms 524 KB Wrong query response.
12 Halted 0 ms 0 KB -