Submission #601659

#TimeUsernameProblemLanguageResultExecution timeMemory
601659BelguteiHighway Tolls (IOI18_highway)C++17
5 / 100
21 ms2916 KiB
#include "highway.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

vector<int> edge[100005];
bool visited[100005];
int last;

void dfs(int node) {
  visited[node] = 1;
  last = node;
  for(auto x: edge[node]) {
    if(visited[x] == 0) dfs(x);
  }
}

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  //
  int M = U.size();
  vector<int> w;
  for(int i = 0; i < M; i ++) w.pb(0);
  ll mx = ask(w);
  for(int i = 0; i < M; i ++) {
    for(int j = 0; j < M; j ++) {
      w[j] = 0;
    }
    w[i] = 1;
    if(ask(w) != mx) {
      edge[U[i]].pb(V[i]);
      edge[V[i]].pb(U[i]);
    }
  }
  dfs(0);
  //
  answer(0, last);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...