Submission #402524

# Submission time Handle Problem Language Result Execution time Memory
402524 2021-05-11T22:07:32 Z Dan4Life Stations (IOI20_stations) C++17
0 / 100
1263 ms 696 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> adj[1001], col(1001);
int lab = 0;
void dfs(int s, int p)
{
    if(col[s]!=-1)return;
    col[s]=lab; lab++;
    for(auto u : adj[s])
        if(u!=p) dfs(u, s);
}

vector<int> label(int n, int k, vector<int> a, vector<int> b)
{
    col.resize(n); lab=0;
    for(int i = 0; i < n; i++) adj[i].clear(), col[i]=-1;
	for (int i = 0; i < n; i++) {
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	for(int i = 0; i < n; i++){
        if(adj[i].size()==1){
            dfs(i, -1); break;
        }
	}
	return col;
}

int find_next_station(int s, int t, vector<int> c)
{
	if(c.size()==1)return c[0];
	for(int i = 0; i < (int)c.size(); i++)
        if(c[i]==t)return c[i];
	if(t<s)return c[0];
	return c[1];
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 548 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1263 ms 528 KB Output is correct
2 Correct 797 ms 400 KB Output is correct
3 Correct 714 ms 400 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 2 ms 464 KB Output is correct
7 Correct 661 ms 508 KB Output is correct
8 Correct 954 ms 500 KB Output is correct
9 Correct 873 ms 400 KB Output is correct
10 Correct 690 ms 516 KB Output is correct
11 Incorrect 7 ms 468 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -