QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#597952 | #9310. Permutation Counting 4 | Jin_Chuanti | Compile Error | / | / | C++14 | 515b | 2024-09-28 19:36:13 | 2024-09-28 19:36:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int a[N] = {0};
int find(int n){
return a[n] == n ? n : f[n] = find(f[n]);
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t, n, l, r, jg;
cin >> t;
while(t--){
cin >> n;
jg = 1;
for(int i = 0; i <= n; i++) a[i] = i;
for(int i = 0; i <= n; i++){
cin >> l >> r;
if(find(l - 1) == find(r)) jg = 0;
else a[find(l - 1)] = find(r);
}
printf("%d\n",jg);
}
return 0;
}
詳細信息
answer.code: In function ‘int find(int)’: answer.code:8:32: error: ‘f’ was not declared in this scope 8 | return a[n] == n ? n : f[n] = find(f[n]); | ^