답안 #1070968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1070968 2024-08-22T22:02:17 Z raduv Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "grader.h"
const int MAXN = 512;
using namespace std;
vector<int> adj[MAXN + 1];
vector<int> islands;
bitset <MAXN + 1> frecv;
void dfs(int node){
  frecv[node] = 1;
  islands.push_back(node);
  for(auto n : adj[node] ){
    if(!frecv[n])
      dfs(n);
  }
}
int findEgg(int n, vector<pair<int, int>> bridges){
  int i, st, dr, mij;
  frecv.reset();
  for( i = 0; i <= MAXN; i++ )
    adj[i].clear();
  islands.clear();
  for( auto [u, v] : bridges ){
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  st = 0;
  dr = n;
  while(dr - st > 1){
    mij = (dr + st) / 2;
    vector <int> qry;
    for( i = 0; i < mij; i++ ){
      qry.push_back(islands[i]);
    }
    if(query(qry))
      dr = mij;
    else
      st = mij;
  }
  return islands[st];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:22:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |   for( auto [u, v] : bridges ){
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -