답안 #397837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397837 2021-05-03T08:34:13 Z cfalas 기지국 (IOI20_stations) C++14
16 / 100
1162 ms 648 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;

#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)

vi label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vi labels(n);
	vector<vi> adj(n, vi());
	FOR(i,n-1){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	// find hub
	int h=0;
	vector<bool> vis(n, false);
	FOR(i,n) if(adj[i].size()>2){
		h=i;
		break;
	}
	labels[h] = 0;
	vis[h] = true;
	int off=1;
	FOA(s,adj[h]){
		int cnt=0;
		bool ff = true;
		while(ff){
			vis[s] = true;
			labels[s] = off+cnt++;
			ff = false;
			FOA(v, adj[s]) if(!vis[v]) s = v, ff=true;
		}
		assert(cnt<=1000);
		off+=1000;
	}
	FOR(i,n) assert(vis[i]);
	//FOA(v,labels) cout<<v<<" "; cout<<endl;
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	//cout<<s<<" "<<t<<endl;
	if(s==0) return t/1000 * 1000 + 1;
	else if(s/1000!=t/1000 || s>t) return *min_element(c.begin(), c.end());
	else return s+1;

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1005
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 584 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 631 ms 528 KB Output is correct
2 Correct 620 ms 520 KB Output is correct
3 Correct 1162 ms 452 KB Output is correct
4 Correct 782 ms 496 KB Output is correct
5 Correct 660 ms 472 KB Output is correct
6 Correct 645 ms 628 KB Output is correct
7 Correct 577 ms 492 KB Output is correct
8 Correct 3 ms 472 KB Output is correct
9 Correct 4 ms 472 KB Output is correct
10 Correct 2 ms 472 KB Output is correct
11 Correct 777 ms 492 KB Output is correct
12 Correct 625 ms 556 KB Output is correct
13 Correct 567 ms 648 KB Output is correct
14 Correct 546 ms 524 KB Output is correct
15 Correct 59 ms 400 KB Output is correct
16 Correct 67 ms 532 KB Output is correct
17 Correct 98 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1008 ms 480 KB Output is correct
2 Correct 585 ms 528 KB Output is correct
3 Correct 698 ms 400 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 6 ms 472 KB Output is correct
6 Correct 2 ms 480 KB Output is correct
7 Correct 648 ms 568 KB Output is correct
8 Correct 934 ms 400 KB Output is correct
9 Correct 732 ms 400 KB Output is correct
10 Correct 591 ms 488 KB Output is correct
11 Runtime error 1 ms 456 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 703 ms 496 KB Partially correct
2 Partially correct 566 ms 524 KB Partially correct
3 Correct 888 ms 400 KB Output is correct
4 Partially correct 660 ms 496 KB Partially correct
5 Partially correct 722 ms 500 KB Partially correct
6 Partially correct 547 ms 528 KB Partially correct
7 Partially correct 519 ms 496 KB Partially correct
8 Partially correct 3 ms 488 KB Partially correct
9 Correct 4 ms 472 KB Output is correct
10 Partially correct 2 ms 472 KB Partially correct
11 Runtime error 1 ms 584 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -