QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574318 | #9310. Permutation Counting 4 | XyeeCheng | WA | 0ms | 3804kb | C++23 | 989b | 2024-09-18 21:31:48 | 2024-09-18 21:31:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n; i >= a; i--)
#define all(x) (x).begin(), (x).end()
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
void solve()
{
int n;
cin >> n;
vector<vector<int>> a(n + 1);
vector<int> vis(n + 1, 0);
rep (i, 1, n)
{
int l, r;
cin >> l >> r;
a[l].push_back(r);
}
rep (i, 1, n)
{
sort(all(a[i]));
}
rep (i, 1, n)
{
int last = i - 1;
for (auto x: a[i])
{
vis[last + 1]++;
if (vis[last + 1] % 2)
{
cout << 0 << endl;
return;
}
last = x;
}
}
rep (i, 1, n) if (vis[i] == 0)
{
cout << 0 << endl;
return;
}
cout << 1 << endl;
}
signed main()
{
IOS;
int t = 1;
cin >> t;
while (t--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3804kb
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:
0 0 0 0
result:
wrong answer 2nd words differ - expected: '1', found: '0'