답안 #106585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106585 2019-04-19T06:50:15 Z tictaccat 통행료 (IOI18_highway) C++14
6 / 100
191 ms 7036 KB
#include "highway.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int N,A,B,M;
ll length;
vector<vector<pair<int,int>>> adj;
vector<pair<int,int>> pos;
vector<int> w;

pair<int,int> find(int L, int R) {

    //cout << L << " " << R << "\n";

    if (R-L == 1) return make_pair(L,R);

    int mid = (L+R)/2;
    
    for (int i = L; i < mid; i++) w[i] = 0;
    for (int i = mid; i < R; i++) w[i] = 1;

    ll z = ask(w);

    int k = (z-length*A)/(B-A);

    if (k == 0) return find(L,mid);
    if (k == length) return find(mid,R);

    return make_pair(mid-(length-k),mid+k);
}

void find_pair(int tempN, std::vector<int> U, std::vector<int> V, int tempA, int tempB) {

    N = tempN; A = tempA; B = tempB; M = U.size(); adj.resize(N); w.resize(M,0);

    for (int i = 0; i < M; i++) {
    adj[U[i]].push_back(make_pair(V[i],i));
    adj[V[i]].push_back(make_pair(U[i],i));
    }
    length = ask(w)/A;

    pair<int,int> res = find(0,N-1);

   // cout << res.first << " " << res.second << "\n";

    answer(res.first,res.second);
   // answer(0, pos[0].first);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 296 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 1024 KB Output is correct
2 Correct 29 ms 1748 KB Output is correct
3 Correct 70 ms 2580 KB Output is correct
4 Correct 164 ms 7036 KB Output is correct
5 Correct 126 ms 7024 KB Output is correct
6 Correct 154 ms 7024 KB Output is correct
7 Correct 141 ms 7028 KB Output is correct
8 Correct 191 ms 6920 KB Output is correct
9 Correct 156 ms 7028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 392 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 1048 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1164 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -