QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#849081 | #9310. Permutation Counting 4 | Starrykiller | WA | 0ms | 3560kb | C++23 | 965b | 2025-01-09 11:43:56 | 2025-01-09 11:43:56 |
Judging History
answer
// Homura Akemi a.k.a. Starrykiller (/user/235125)
// I love Madoka Kaname forever!
#include <bits/stdc++.h>
using namespace std;
auto range(auto l, auto r) { return views::iota(l,r); }
auto rev=views::reverse;
_GLIBCXX_ALWAYS_INLINE void chmax(auto &a, auto b) { a=max(a,b); }
_GLIBCXX_ALWAYS_INLINE void chmin(auto &a, auto b) { a=min(a,b); }
// #define int long long
struct dsu {
vector<int> fa;
dsu() {}
dsu(int n) {
fa.resize(n);
for (int i=0; i<n; ++i) fa[i]=i;
}
int get(int x) { return fa[x]==x?x:fa[x]=get(fa[x]); }
void merge(int x, int y) { fa[get(x)]=get(y); }
};
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int T; cin>>T;
// int T=1;
while (T--) []{
int n; cin>>n;
dsu d(n+1);
for (int i=1; i<=n; ++i) {
int l, r; cin>>l>>r;
if (d.get(--l)==d.get(r)) {
cout<<"0\n"; return;
}
cout<<1<<'\n';
}
}();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3560kb
input:
4 5 1 2 1 5 1 2 1 2 2 2 5 1 1 2 4 2 3 5 5 3 4 5 3 5 1 2 3 4 3 5 3 3 5 1 5 1 4 4 5 5 5 1 2
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
wrong answer 1st words differ - expected: '0', found: '1'