Submission #782411

# Submission time Handle Problem Language Result Execution time Memory
782411 2023-07-13T23:34:57 Z vjudge1 Highway Tolls (IOI18_highway) C++17
6 / 100
70 ms 2416 KB
#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) {
    int M = U.size();
    std::vector<int> w(M, 0);
    long long toll = ask(w);
    long long dis = toll/A;
    int l = 0, r = N-1;
    while(l<r) {
        vector<int> v(M, 0);
        int mid = l+r>>1;
        for(int i = 0; i <= mid; i++)
            v[i] = 1;
        toll = ask(v);                       
        if(toll==A*dis) {
            l = mid+1;
        } else if (toll==B*dis){
            r = mid;
        } else {
            long long over = toll-dis*A;
            over/=(B-A);
            answer(mid-over+1, mid-over+1+dis);
            return;
        }
        if(r-l+1==dis) {
            answer(l, r+1);
            return;
        }
    }
}

Compilation message

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:12:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |         int mid = l+r>>1;
      |                   ~^~
# 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 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 9 ms 464 KB Output is correct
2 Correct 13 ms 708 KB Output is correct
3 Correct 19 ms 960 KB Output is correct
4 Correct 40 ms 2408 KB Output is correct
5 Correct 70 ms 2408 KB Output is correct
6 Correct 44 ms 2404 KB Output is correct
7 Correct 69 ms 2416 KB Output is correct
8 Correct 68 ms 2392 KB Output is correct
9 Correct 53 ms 2416 KB Output is correct
# 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 9 ms 464 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 556 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -