Submission #1073795

# Submission time Handle Problem Language Result Execution time Memory
1073795 2024-08-24T21:33:09 Z shezitt Highway Tolls (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);

}
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 856 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 600 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 628 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -