답안 #1010338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010338 2024-06-28T21:01:32 Z HappyCapybara 통행료 (IOI18_highway) C++17
0 / 100
9 ms 1348 KB
#include "highway.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long

void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
  int M = U.size();
  vector<vector<pair<int,int>>> g(N);
  for (int i=0; i<M; i++){
    g[U[i]].push_back({V[i], i});
    g[V[i]].push_back({V[i], i});
  }
  vector<int> f(M, 0);
  int d = ask(f)/A;
  vector<int> dist(N, -1);
  queue<int> q;
  q.push(0);
  dist[0] = 0;
  vector<pair<int,int>> pos;
  while (!q.empty()){
    int cur = q.front();
    q.pop();
    for (pair<int,int> next : g[cur]){
      if (dist[next.first] != -1) continue;
      dist[next.first] = dist[cur]+1;
      if (dist[next.first] == d) pos.push_back(next);
      else q.push(next.first);
    }
  }
  int l = 0, r = pos.size();
  while (l != r-1){
    int m = (l+r)/2;
    vector<int> w(M, 0);
    for (int i=l; i<m; i++) w[pos[i].second] = 1;
    if (ask(w) > d*A) r = m;
    else l = m;
  }
  answer(0, pos[l].first);
}
# 결과 실행 시간 메모리 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 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1112 KB Output is incorrect: {s, t} is wrong.
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 1348 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -