QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#34682 | #4251. Game | jli505# | Compile Error | / | / | C++20 | 2.0kb | 2022-06-12 04:41:54 | 2024-05-26 00:51:59 |
Judging History
你现在查看的是最新测评结果
- [2024-05-26 00:51:59]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-06-12 04:41:54]
- 提交
answer
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
void fastIO(){
ios_base::sync_with_stdio(false);
cin.tie(0);
}
int N, M, K;
vector<int> adj[100100];
stack<int> S;
int cnt = 0;
int dfn[100100], low[100100];
bool in_stack[100100];
int time_in = 0;
int kingdom[100100];
int self_e[100100];
void init(int n, int k){
N = n;
K = k;
for (int i = 0; i < k-1; i++){
adj[i].push_back(i+1);
}
}
void dfs(int node){
dfn[node] = ++time_in;
low[node] = dfn[node];
S.push(node);
in_stack[node] = true;
for (int nx : adj[node]){
if (!dfn[nx]){
dfs(nx);
low[node] = min(low[node], low[nx]);
} else if (in_stack[nx]){
low[node] = min(low[node], dfn[nx]);
}
}
if (low[node] == dfn[node]){
++cnt;
while (S.top() != node){
kcnt[cnt]++;
kingdom[S.top()] = cnt;
in_stack[S.top()] = false;
S.pop();
}
kcnt[cnt]++;
kingdom[S.top()] = cnt;
in_stack[S.top()] = false;
S.pop();
}
}
int kcnt[100100];
bool good = false;
int pre_time_in = 0;
int add_teleporter(int u, int v){
if (good) return true;
if (u == v){
self_e[u]++;
}
pre_time_in = time_in;
adj[u].push_back(v);
cnt = 0;
for (int i = 0; i < K; i++){
kcnt[i] = kingdom[i] = 0;
}
while (!S.empty()){
in_stack[S.top()] = false;
S.pop();
}
for (int i = 0; i < K; i++){
if (dfn[i] <= pre_time_in){
dfs(i);
}
}
/*for (int i = 0; i < N; i++){
cout << kingdom[i] << " ";
}
cout << "\n";*/
bool work = false;
for (int i = 0; i < K; i++){
if (kcnt[kingdom[i]] > 1 || self_e[i]){
work = true;
good = true;
}
}
return work;
}
Details
answer.code: In function ‘void dfs(int)’: answer.code:51:13: error: ‘kcnt’ was not declared in this scope; did you mean ‘cnt’? 51 | kcnt[cnt]++; | ^~~~ | cnt answer.code:56:9: error: ‘kcnt’ was not declared in this scope; did you mean ‘cnt’? 56 | kcnt[cnt]++; | ^~~~ | cnt