Submission #582413

# Submission time Handle Problem Language Result Execution time Memory
582413 2022-06-23T17:54:11 Z Vanilla Highway Tolls (IOI18_highway) C++17
5 / 100
233 ms 262144 KB
#include <bits/stdc++.h>
#include "highway.h"
typedef long long int64;
using namespace std;
const int maxn = 9e4 + 2;
const int maxm = 13e4 + 2;
vector <pair <int, int> > ad [maxn];
vector <int> w;
int n;
int64 len, a, b;
bool done = 0;

void dfs (int u, int p, int64 d = 0) {
  if (done) return;
  if (d == len && ask(w) == len * b) {
    answer(0, u);
    done = 1;
    return;
  }
  for (pair <int, int> v: ad[u]) {
    if (v.first == p) continue;
    w[v.second] = 1;
    dfs(v.first, u, d + 1);
    w[v.second] = 0;
  }
}

void find_pair(int N, vector<int> u, vector<int> v, int A, int B) {
  int m = u.size();
  n = N, a = A, b = B;
  for (int i = 0; i < m; i++){
    ad[u[i]].push_back({v[i], i});
    ad[v[i]].push_back({u[i], i});
  }
  for (int i = 0; i < m; i++){
    w.push_back(0);
  }
  len = ask(w) / a;
  dfs(0, -1);
  assert(done);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Correct 2 ms 2384 KB Output is correct
3 Correct 2 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 2 ms 2384 KB Output is correct
6 Correct 2 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 1 ms 2384 KB Output is correct
9 Correct 2 ms 2384 KB Output is correct
10 Correct 1 ms 2500 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 2 ms 2432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2384 KB Output is correct
2 Runtime error 17 ms 3024 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 7120 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2384 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 233 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 212 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -