Submission #836263

# Submission time Handle Problem Language Result Execution time Memory
836263 2023-08-24T09:22:03 Z mousebeaver Highway Tolls (IOI18_highway) C++14
6 / 100
115 ms 2096 KB
#define ll long long
#define pll pair<ll, ll>
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;

void find_pair(int n, std::vector<int> u, std::vector<int> v, int a, int b) 
{
    vector<int> w(n-1, 0);
    ll dist = ask(w);

    //Find first station:
    int left = 0;
    int right = n-1;
    while(left < right)
    {
        int mid = (left+right)/2;
        w.assign(n-1, 0);
        for(int i = 0; i <= mid; i++)
        {
            w[i] = 1;
        }

        if(ask(w) > dist)
        {
            right = mid;
        }
        else
        {
            left = mid+1;
        }
    }
    int start = left;

    //Find second station:
    left = 1;
    right = n;
    while(left < right)
    {
        int mid = (left+right+1)/2;
        w.assign(n-1, 0);
        for(int i = n; i >= mid; i--)
        {
            w[i-1]= 1;
        }

        if(ask(w) > dist)
        {
            left = mid;
        }
        else
        {
            right = mid-1;
        }
    }
    int goal = left;

    answer(start, goal);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 484 KB Output is correct
2 Correct 11 ms 576 KB Output is correct
3 Correct 18 ms 864 KB Output is correct
4 Correct 46 ms 2052 KB Output is correct
5 Correct 53 ms 2064 KB Output is correct
6 Correct 49 ms 2096 KB Output is correct
7 Correct 115 ms 2072 KB Output is correct
8 Correct 48 ms 2056 KB Output is correct
9 Correct 54 ms 2064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 464 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 464 KB Incorrect
2 Halted 0 ms 0 KB -