QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574726 | #9310. Permutation Counting 4 | 495684945 | WA | 0ms | 3628kb | C++20 | 899b | 2024-09-19 00:06:54 | 2024-09-19 00:06:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
void solve() {
int n;
cin >> n;
vector<vector<int>> intervals(n + 1);
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
intervals[x].push_back(y);
}
priority_queue<int, vector<int>, greater<int>> pq;
for (int i = 1; i <= n; i++) {
for (int y : intervals[i]) {
pq.push(y);
}
if (pq.empty()) {
cout << 0 << endl;
return;
}
int y = pq.top();
pq.pop();
if (y < i) {
cout << 0 << endl;
return;
}
}
cout << 1 << endl;
}
signed main() {
int t;
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while (t--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
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 1 0 1
result:
wrong answer 4th words differ - expected: '0', found: '1'