Submission #305441

# Submission time Handle Problem Language Result Execution time Memory
305441 2020-09-23T06:49:14 Z lohacho Stations (IOI20_stations) C++14
0 / 100
3000 ms 512 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const int INF = (int)1e9 + 7;
const int NS = (int)1e3 + 4;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n);
	int label_num = 0, chk[NS];
	vector < int > way[NS];
	for(int i = 0; i < n - 1; ++i){
        way[u[i]].push_back(v[i]);
        way[v[i]].push_back(u[i]);
	}
	function < void(int, int) > dfs = [&](int x, int dep){
        chk[x] = 1;
        if(dep % 2) labels[x] = label_num++;
        for(auto&nxt:way[x]){
            if(chk[nxt]) continue;
            dfs(nxt, dep + 1);
        }
        if(dep % 2 == 0) labels[x] = label_num++;
	};
	dfs(0, 1);
	for(int i = 0; i < (int)labels.size(); ++i){
        for(int j = i + 1; j < (int)labels.size(); ++j){
            if(labels[i] == labels[j]){
                while(1){
                    puts("WHAT");
                }
            }
        }
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(s < c[0]){
        if(t < s || t > c[(int)c.size() - 2]) return c.back();
        for(auto&i:c){
            if(t <= i) return i;
        }
    }
    else{
        if(t < c[1] || t > s) return c.front();
        for(int i = (int)c.size() - 1; ; --i){
            if(t >= i) return i;
        }
    }
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
# Verdict Execution time Memory Grader output
1 Execution timed out 3040 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3017 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3031 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3037 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3051 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -