Submission #776529

# Submission time Handle Problem Language Result Execution time Memory
776529 2023-07-08T03:24:38 Z Magikarp4000 Highway Tolls (IOI18_highway) C++17
6 / 100
254 ms 262144 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
#define OPTM ios_base::sync_with_stdio(0); cin.tie(0);
#define INF int(1e9+7)
#define ln '\n' 
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define FOR(i,s,n) for (int i = s; i < n; i++)
#define FORR(i,n,s) for (int i = n; i > s; i--)
#define FORX(u, arr) for (auto u : arr)
#define PB push_back
#define in(v,x) (v.find(x) != v.end())
#define F first
#define S second
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define UM unordered_map
#define US unordered_set
#define PQ priority_queue
#define ALL(v) v.begin(), v.end()
const ll LLINF = 1e18+1;
#define int long long

struct Edge {
    int x,y,depth;
};

const int MAXN = 9e4+5;
int n,m;
vector<PII> v[MAXN];
vector<int32_t> w;
vector<Edge> e;
int d[MAXN];

void dfs(int s, int pa) {
    FORX(u,v[s]) {
        int to = u.F, idx = u.S;
        if (to == pa) continue;
        d[to] = d[s]+1;
        e[idx].depth = d[to];
        if (e[idx].y != to) swap(e[idx].x, e[idx].y);
        dfs(to,s);
    }
}

void find_pair(int32_t N, std::vector<int32_t> U, std::vector<int32_t> V, int32_t A, int32_t B) {
    n = N; m = U.size();
    FOR(i,0,m) {
        v[U[i]].PB({V[i],i});
        v[V[i]].PB({U[i],i});
        e.PB({U[i],V[i],-1LL});
    }
    dfs(0,-1);
    // cout << "ahahaha" << ln;
    FOR(i,0,m) w.PB(0);
    int dist = ask(w)/A;
    int l = 0, r = m-1;
    // cout << dist << ln;
    // answer(0,n-1);
    // return;
    while (l < r) {
        FOR(i,0,n) w[i] = 0;
        int mid = (l+r)/2;
        FOR(i,l,mid+1) w[i] = 1;
        int val = ask(w);
        bool left = 1;
        if (val%A == 0) {
            left = val/A == dist ? 0 : 1;
        }
        if (left) r = mid;
        else l = mid+1;
    }
    int32_t S = l, T = l+dist;
    // cout << "S T: " << S << " " << T << ln;
    answer(S,T);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2384 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2512 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 3852 KB Output is correct
2 Correct 14 ms 5440 KB Output is correct
3 Correct 35 ms 6780 KB Output is correct
4 Correct 69 ms 15956 KB Output is correct
5 Correct 53 ms 15892 KB Output is correct
6 Correct 59 ms 15968 KB Output is correct
7 Correct 90 ms 15964 KB Output is correct
8 Correct 61 ms 15892 KB Output is correct
9 Correct 75 ms 16064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2512 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 254 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 190 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -