Submission #781483

# Submission time Handle Problem Language Result Execution time Memory
781483 2023-07-13T06:54:01 Z vjudge1 Highway Tolls (IOI18_highway) C++17
0 / 100
82 ms 2412 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);
    int 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 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 8 ms 496 KB Output is correct
2 Correct 15 ms 720 KB Output is correct
3 Correct 20 ms 904 KB Output is correct
4 Correct 67 ms 2400 KB Output is correct
5 Correct 59 ms 2404 KB Output is correct
6 Correct 50 ms 2392 KB Output is correct
7 Correct 45 ms 2412 KB Output is correct
8 Correct 57 ms 2328 KB Output is correct
9 Incorrect 82 ms 2392 KB Output is incorrect: {s, t} is wrong.
10 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 Incorrect 11 ms 516 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 -