QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#573332 | #9313. Make Max | MaxDYF | WA | 0ms | 3640kb | C++23 | 732b | 2024-09-18 18:11:33 | 2024-09-18 18:11:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void work()
{
int n;
cin >> n;
typedef pair<int, int> pii;
priority_queue<pii, vector<pii>, greater<pii>> q;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
q.push({x, y});
}
int lst_l = 0, lst_r = 0;
while (!q.empty())
{
auto [x, y] = q.top();
q.pop();
if (x == lst_l)
{
if (y == lst_r)
{
cout << 0 << '\n';
return;
}
q.push({lst_r + 1, y});
continue;
}
if (lst_l + 1 != x)
{
cout << 0 << '\n';
return;
}
lst_l = x;
lst_r = y;
}
cout << (lst_l == n ? "1\n" : "0\n");
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
work();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3640kb
input:
4 2 1 2 2 2 2 7 1 1 1 2 2 2 2 3 1 2 3
output:
1 0 0 0
result:
wrong answer 3rd numbers differ - expected: '3', found: '0'