QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449123#4251. GameMispertion0 0ms5868kbC++231.2kb2024-06-20 17:51:472024-06-20 17:51:47

Judging History

你现在查看的是最新测评结果

  • [2024-06-20 17:51:47]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:5868kb
  • [2024-06-20 17:51:47]
  • 提交

answer

#include "game.h"
#include <bits/stdc++.h>

using namespace std;

#define pb(x) push_back(x);

const int N = 5e5;
const int infi = INT_MAX;

vector<int> g[N], ig[N];
int n, k, lf[N], rt[N];

bool add_edge(int u, int v);

bool upd_vert(int v){
    for(auto u : g[v]){
        if(add_edge(v, u))
            return true;
    }
    for(auto u : ig[v]){
        if(add_edge(u, v))
            return true;
    }
    return false;
}

bool add_edge(int u, int v){
    //u-->v
    if(rt[u] <= lf[v]){
        return false;
    }
    if(rt[v] <= lf[u])
        return true;
    if(lf[u] == lf[v] && rt[u] == rt[v])
        return false;
    if((lf[u] + rt[u]) / 2 >= rt[v]){
        rt[u] = (lf[u] + rt[u]) / 2;
        return upd_vert(u);
    }else if((lf[v] + rt[v]) / 2 <= lf[u]){
        lf[v] = (lf[v] + rt[v]) / 2;
        return upd_vert(v);
    }else{
        return false;
    }
}

void init(int _n, int _k) {
    n = _n;
    k = _k;
    for(int i = 1; i <= k; i++)
        lf[i] = i, rt[i] = i + 1;
    for(int i = k + 1; i <= n; i++)
        lf[i] = 0, rt[i] = k + 2;
}

int add_teleporter(int u, int v) {
    u++;
    v++;
    g[u].pb(v);
    ig[v].pb(u);
    return add_edge(u, v);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5868kb

input:

1 1
1
893123 893123
-1

output:

1

result:

wrong answer Wrong Answer [1]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%