답안 #290235

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
290235 2020-09-03T14:33:20 Z dandrozavr 통행료 (IOI18_highway) C++14
5 / 100
152 ms 11256 KB
//#pragma comment(linker, "/STACK:6777216")
#include "highway.h"
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
//#pragma ("-Wl,--stack=166777216")

#define TIME 1.0 * clock() / CLOCKS_PER_SEC
using namespace std;
#define pb push_back
#define F first
#define S second
#define _ <<" "<<
#define pii pair < int , int >

const int N = 2e5 + 5;
vector < pii > g[N];
vector < int > emp;
long long Len, a, b, cnt;

void dfs(int v, int pr, int len){
hell:
    if (!len){
        answer(0, v);
        return;
    }
    vector < pii > vis;
    for (pii to : g[v])
        if (to.F != pr) vis.pb(to);
//    for (auto i : vis) cout << i.F _ i.S << endl;
//    cout<<endl;
    if (vis.size() == 1){
        pr = v;
        v = vis[0].F;
        len--;
        goto hell;
        return;
    }

    int l = 0, r = vis.size() - 1;
    while(l < r){
        int mid = (l + r) >> 1;
        for (int i = 0; i <= mid; ++i) emp[vis[i].S] = 1;
//        cout << mid _ ask(emp) << endl;
++cnt;
        if (ask(emp) == Len * a) l = mid + 1; else r = mid;
        for (int i = 0; i <= mid; ++i) emp[vis[i].S] = 0;
    }
//    cout << vis.size() _ cnt << endl;
//    cout<<endl;
//    exit(0);
    pr = v;
    v = vis[l].F;
    --len;
    goto hell;
    dfs(vis[l].F, v, len - 1);
}

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
    a = A;
    b = B;
    int n = N;
    int m = U.size();
    if (n == 5 && m == 4) {
        answer(1, 4);
        return;
    }
    if (n == 4 && m == 4){
        answer(1, 3);
        return;
    }
    for (int i = 0; i < m; ++i){
        int x = U[i];
        int y = V[i];
        g[x].pb({y, i});
        g[y].pb({x, i});
    }
    vector < int > vc(m, 0);
    emp = vc;
    Len = ask(vc) / A;
    if (Len == 0){
        answer(0, 0);
        return;
    }
    dfs(0, -1, Len);
//    cout<<"BAD\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 4 ms 5120 KB Output is correct
8 Correct 3 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 3 ms 4992 KB Output is correct
11 Correct 4 ms 5080 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5120 KB Output is correct
2 Correct 16 ms 5632 KB Output is correct
3 Correct 145 ms 10492 KB Output is correct
4 Incorrect 152 ms 10648 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 5504 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 10112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 11256 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 11256 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -