QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#449123 | #4251. Game | Mispertion | 0 | 0ms | 5868kb | C++23 | 1.2kb | 2024-06-20 17:51:47 | 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);
}
详细
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%