답안 #306905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306905 2020-09-26T14:10:06 Z giorgikob 기지국 (IOI20_stations) C++14
5 / 100
903 ms 1044 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e3+5;

vector<int>gr[N];

int cnt = 0;
int fix[N];
//int c = 0;

void dfs(int x, vector<int>&v){
    fix[x] = 1;
    v[x] = cnt; cnt++;
    for(auto to : gr[x]){
        if(fix[to]) continue;
        dfs(to,v);
    }
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	std::vector<int> labels(n,0);

	for(int i = 0; i < u.size(); i++){
        int x = u[i];
        int y = v[i];
        gr[x].pb(y);
        gr[y].pb(x);
	}
    cnt = 0;
	for(int i = 0; i < n; i++){
        if(gr[i].size() == 1){
            dfs(i,labels);
            break;
        }
	}

	//for(auto x : labels) cout << x <<" "; cout << endl;
	//if(labels[0] == 0) dfs(0,labels);

	for(int i = 0; i < n; i++) gr[i].clear(), fix[i] = 0;

	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(c.size() == 1) return c[0];
    if(s > t) return c[0];
	return c[1];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for(int i = 0; i < u.size(); i++){
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 552 ms 1024 KB Output is correct
2 Correct 440 ms 784 KB Output is correct
3 Correct 880 ms 896 KB Output is correct
4 Correct 653 ms 1012 KB Output is correct
5 Correct 569 ms 768 KB Output is correct
6 Correct 458 ms 800 KB Output is correct
7 Correct 483 ms 768 KB Output is correct
8 Correct 2 ms 768 KB Output is correct
9 Correct 5 ms 876 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 491 ms 808 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 528 ms 1044 KB Output is correct
2 Correct 456 ms 792 KB Output is correct
3 Correct 867 ms 768 KB Output is correct
4 Correct 657 ms 1024 KB Output is correct
5 Correct 585 ms 876 KB Output is correct
6 Correct 457 ms 796 KB Output is correct
7 Correct 431 ms 808 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 5 ms 880 KB Output is correct
10 Correct 1 ms 1000 KB Output is correct
11 Incorrect 607 ms 672 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 857 ms 1008 KB Output is correct
2 Correct 650 ms 768 KB Output is correct
3 Correct 566 ms 1024 KB Output is correct
4 Correct 3 ms 884 KB Output is correct
5 Correct 5 ms 892 KB Output is correct
6 Correct 1 ms 1016 KB Output is correct
7 Incorrect 593 ms 768 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 531 ms 768 KB Output is correct
2 Correct 455 ms 768 KB Output is correct
3 Correct 903 ms 1032 KB Output is correct
4 Correct 656 ms 872 KB Output is correct
5 Correct 560 ms 768 KB Output is correct
6 Correct 456 ms 768 KB Output is correct
7 Correct 464 ms 796 KB Output is correct
8 Correct 3 ms 872 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 2 ms 880 KB Output is correct
11 Incorrect 440 ms 804 KB Wrong query response.
12 Halted 0 ms 0 KB -