Submission #946670

# Submission time Handle Problem Language Result Execution time Memory
946670 2024-03-14T21:36:24 Z PagodePaiva Highway Tolls (IOI18_highway) C++17
6 / 100
88 ms 2236 KB
#include "highway.h"
#include<bits/stdc++.h>
#define N 90010
#define ll long long

using namespace std;

void find_pair(int n, std::vector<int> u, std::vector<int> v, int an, int bn) {
  ll a = an;
  ll b = bn;
  int l = 0, r = n-2;
  vector <int> w(n-1);
  for(int i = 0;i < n-1;i++) w[i] = 0;
  ll custo = ask(w);
  ll d = custo/a;
  while(l < r){
    int mid = (l+r)/2;
    for(int i = l;i <= mid;i++){
      w[i] = 1;
    }
    custo = ask(w);
    if(d*a == custo){
      l = mid+1;
    }
    else{
      r = mid;
    }
    for(int i = 0;i < n-1;i++) w[i] = 0;
  }
  answer(l, l+d);
  return;
  // int M = U.size();
  // for (int j = 0; j < 50; ++j) {
  //   std::vector<int> w(M);
  //   for (int i = 0; i < M; ++i) {
  //     w[i] = 0;
  //   }
  //   long long toll = ask(w);
  // }
  // answer(0, N - 1);
}

Compilation message

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:10:6: warning: unused variable 'b' [-Wunused-variable]
   10 |   ll b = bn;
      |      ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 600 KB Output is correct
2 Correct 13 ms 580 KB Output is correct
3 Correct 18 ms 1024 KB Output is correct
4 Correct 51 ms 2192 KB Output is correct
5 Correct 70 ms 2236 KB Output is correct
6 Correct 49 ms 2204 KB Output is correct
7 Correct 60 ms 2188 KB Output is correct
8 Correct 88 ms 2184 KB Output is correct
9 Correct 64 ms 2188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 600 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 612 KB Incorrect
2 Halted 0 ms 0 KB -