답안 #432873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432873 2021-06-18T14:25:58 Z lior5654 기지국 (IOI20_stations) C++17
5 / 100
926 ms 636 KB
#include <bits/stdc++.h>

using namespace std;


typedef long long int ll;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
typedef vector<vpl> vvpl;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(c) (c.begin()), (c.end())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second


#include "stations.h"


const int maxn = 1e3 + 5;

vi g[maxn];


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

    rep(i, n-1) {
        g[u[i]].pb(v[i]);
        g[v[i]].pb(u[i]);
    }
    int fir = -1;
    for(int i = 0; i < n; ++i) {
        if(g[i].size() == 1) {
            fir = i; break;
        }
    }
 
    assert(fir != -1);
    int pre = -1;
    int cur = fir;
    rep(i, n) {
        res[cur] = i;
        for(auto e : g[cur]) {
            if(e!=pre) {
                pre = cur; cur = e; break;
            }
        }
    }

    rep(i, n) {
        g[i].clear();
    }
    return res;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(s < t && s < c[0] || s > t && s > c[0]) {
        return c[0];
    } else {
        return c[1];
    }
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:67:11: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   67 |  if(s < t && s < c[0] || s > t && s > c[0]) {
# 결과 실행 시간 메모리 Grader output
1 Correct 564 ms 508 KB Output is correct
2 Correct 424 ms 636 KB Output is correct
3 Correct 921 ms 452 KB Output is correct
4 Correct 651 ms 508 KB Output is correct
5 Correct 563 ms 512 KB Output is correct
6 Correct 445 ms 528 KB Output is correct
7 Correct 432 ms 516 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 4 ms 476 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 304 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 523 ms 520 KB Output is correct
2 Correct 460 ms 508 KB Output is correct
3 Correct 857 ms 516 KB Output is correct
4 Correct 635 ms 400 KB Output is correct
5 Correct 578 ms 512 KB Output is correct
6 Correct 457 ms 504 KB Output is correct
7 Correct 475 ms 512 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 0 ms 468 KB Output is correct
11 Incorrect 1 ms 312 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 926 ms 400 KB Output is correct
2 Correct 701 ms 400 KB Output is correct
3 Correct 595 ms 512 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 4 ms 420 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 1 ms 308 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 557 ms 528 KB Output is correct
2 Correct 382 ms 528 KB Output is correct
3 Correct 822 ms 400 KB Output is correct
4 Correct 640 ms 400 KB Output is correct
5 Correct 590 ms 400 KB Output is correct
6 Correct 475 ms 528 KB Output is correct
7 Correct 456 ms 528 KB Output is correct
8 Correct 3 ms 480 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Incorrect 4 ms 320 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -