답안 #411459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411459 2021-05-25T11:18:32 Z AKaan37 기지국 (IOI20_stations) C++17
5 / 100
1200 ms 652 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 1005;
const lo mod = 1000000007;

vector<int> vec[li],vv;

inline void dfs(int node,int ata){
	//~ cout<<node<<endl;
	vv.pb(node);
	for(auto go:vec[node]){
		if(go==ata)continue;
		dfs(go,node);
	}
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> vvv) {
	vector<int> labels(n);
	vv.clear();
	for(int i=0;i<n;i++)vec[i].clear();
	for(int i=0;i<n-1;i++){
		vec[u[i]].pb(vvv[i]);
		vec[vvv[i]].pb(u[i]);
	}
	int ind=0;
	for(int i=0;i<n;i++){
		if((int)vec[i].size()==1)ind=i;
	}
	
	//~ cout<<ind<<endl;
	dfs(ind,-1);
	
	//~ for(auto go:vv)printf("%d **\n",go);
	for (int i = 0; i < n; i++) {
		//~ cout<<vv[i]<<endl;
		labels[vv[i]]=i;
		//~ labels.pb(vv[i]);
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	//~ while(1){s++;}
	//~ cout<<s<<" :: "<<t<<" :: "<<c[0]<<" :: "<<c[1]<<endl;
	if((int)c.size()==1)return c[0];
	if(s==t)return s;
	if(t>s){return c[1];}
	else return c[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 752 ms 652 KB Output is correct
2 Correct 520 ms 528 KB Output is correct
3 Correct 1200 ms 400 KB Output is correct
4 Correct 906 ms 512 KB Output is correct
5 Correct 773 ms 508 KB Output is correct
6 Correct 488 ms 504 KB Output is correct
7 Correct 402 ms 512 KB Output is correct
8 Correct 3 ms 464 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 2 ms 444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 513 ms 504 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 645 ms 628 KB Output is correct
2 Correct 588 ms 512 KB Output is correct
3 Correct 965 ms 400 KB Output is correct
4 Correct 825 ms 512 KB Output is correct
5 Correct 740 ms 528 KB Output is correct
6 Correct 603 ms 512 KB Output is correct
7 Correct 604 ms 528 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 464 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Incorrect 827 ms 512 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1014 ms 520 KB Output is correct
2 Correct 723 ms 400 KB Output is correct
3 Correct 692 ms 400 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 672 ms 400 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 568 ms 540 KB Output is correct
2 Correct 533 ms 520 KB Output is correct
3 Correct 1006 ms 400 KB Output is correct
4 Correct 704 ms 400 KB Output is correct
5 Correct 664 ms 512 KB Output is correct
6 Correct 456 ms 508 KB Output is correct
7 Correct 525 ms 528 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Incorrect 595 ms 512 KB Wrong query response.
12 Halted 0 ms 0 KB -