답안 #272179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
272179 2020-08-18T10:14:03 Z erray Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
4 ms 384 KB
// author: erray
#include<bits/stdc++.h>
#include "grader.h"
 
using namespace std;

int findEgg(int n, vector<pair<int, int>> edges) {
  vector<vector<int>> g(n);
  for (auto e : edges) {
    g[e.first - 1].push_back(e.second - 1);
    g[e.second - 1].push_back(e.first - 1);
  }
  vector<int> ask;
  function<void(int, int)> dfs = [&](int v, int pr) {
    ask.push_back(v);
    for (auto u : g[v]) {
      if (u == pr) continue;
      dfs(u, v);
    }
  };
  dfs(0, -1);
  assert(ask.size() == n);
  /*     
  int s = 0, e = n - 1;
  while (s != e) {
    int mid = (s + e) >> 1;
    vector<int> q;
    for (int i = 0; i <= mid; ++i) q.push_back(ask[i] + 1);
    if (query(q)) e = mid;
    else s = mid + 1;
  }
  return ask[s];
  */
  return 1;
}
 

Compilation message

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from grader.h:1,
                 from eastereggs.cpp:3:
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |   assert(ask.size() == n);
      |          ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB The found island is incorrect
2 Halted 0 ms 0 KB -