Submission #402523

# Submission time Handle Problem Language Result Execution time Memory
402523 2021-05-11T22:06:26 Z Dan4Life Stations (IOI20_stations) C++17
0 / 100
1265 ms 700 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 < 1001; 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 3 ms 584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 568 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1002 ms 520 KB Output is correct
2 Correct 757 ms 520 KB Output is correct
3 Correct 733 ms 428 KB Output is correct
4 Correct 3 ms 488 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 2 ms 464 KB Output is correct
7 Correct 693 ms 516 KB Output is correct
8 Correct 1265 ms 400 KB Output is correct
9 Correct 796 ms 400 KB Output is correct
10 Correct 722 ms 400 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 584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -