답안 #1073795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1073795 2024-08-24T21:33:09 Z shezitt 통행료 (IOI18_highway) C++14
5 / 100
9 ms 856 KB
#include "highway.h"
#include <bits/stdc++.h>

using ll = long long;
using namespace std;

#define pb push_back

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  int M = U.size();
  
  vector<int> tmp(M, 0);
  vector<bool> sirve(M, 1);

  ll W = ask(tmp);

  for(int i=0; i<M; ++i){
    tmp[i] = 1;
    ll w = ask(tmp);
    if(w == W){
      sirve[i] = 0;
    }
    tmp[i] = 0;
  }

  vector<vector<int>> adj(N+1);
  for(int i=0; i<M; ++i) if(sirve[i]){
    adj[U[i]].pb(V[i]);
    adj[V[i]].pb(U[i]);
  }

  auto dfs = [&](auto dfs, int at, int pa=-1) -> int {
    for(int u : adj[at]){ 
      if(u == pa) continue;
      return dfs(dfs, u, at);
    }
    return at;
  };

  int s = dfs(dfs, 0);  
  answer(0, s);

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 856 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 600 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 628 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -