답안 #306043

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306043 2020-09-24T11:18:15 Z eriksuenderhauf 기지국 (IOI20_stations) C++17
0 / 100
6 ms 672 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
  vector<int> deg(n);
  vector<vector<int>> adj(n);
  for (int i = 0; i < n - 1; i++)
    deg[u[i]]++, deg[v[i]]++, adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]);;
  vector<int> labels(n);
  if (*max_element(deg.begin(), deg.end()) <= 2) {
    int r = min_element(deg.begin(), deg.end()) - deg.begin(), p = -1;
    labels[r] = 0;
    for (int i = 1; i < n; i++) {
      adj[r].erase(find(adj[r].begin(), adj[r].end(), p));
      tie(r, p) = make_pair(adj[r][0], r);
      labels[r] = i;
    }
  }
  return labels;
}

int find_next_station(int s, int t, vector<int> c) {
  return s < t ? *max_element(c.begin(), c.end()) : *min_element(c.begin(), c.end());
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -