QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#867775 | #9982. Staircase Museum | JEdward | WA | 9ms | 3712kb | C++20 | 747b | 2025-01-23 23:55:58 | 2025-01-23 23:55:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void sol() {
int n;
cin >> n;
deque<array<int, 2>> dq;
int ans = 0;
for(int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;
while(!dq.empty() && dq.front()[0] < l) {
dq.pop_front();
}
if(dq.empty()) {
ans += 1;
dq.push_back({l, r});
} else {
l = dq.back()[1] + 1;
if(l <= r){
ans += 1;
dq.push_back({l, r});
}
}
}
cout << ans << endl;
}
int main() {
cin.tie(0)->ios::sync_with_stdio(0);
int tc = 1;
cin >> tc;
while(tc--){
sol();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
4 3 1 2 1 3 1 3 3 1 2 2 3 3 3 3 1 1 1 3 3 3 4 1 2 2 3 3 4 4 5
output:
2 3 3 4
result:
ok 4 number(s): "2 3 3 4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1 1 1 1000000000
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: -100
Wrong Answer
time: 9ms
memory: 3584kb
input:
9653 1 1 1 2 1 1 1 1 3 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 6 1 2 1 2 1 2 1 2 1 2 2 2 6 1 1 1 1 1 1 1 1 1 1 1 2 6 1 2 1 2 1 2 1 2 1 2 2 3 5 1 2 1 2 1 2 1 2 2 2 6 1 2 1 2 1 2 1 2 2 2 2 2 6 1 3 1 3 1 3 1 3 2 3 3 3 6 1 2 1 2 1 2 1 2 2 2 2 3 6 1 3 1 3 1 3 1 3 2 3...
output:
1 1 1 1 1 1 2 2 2 2 2 3 3 3 2 2 2 3 3 2 3 2 2 3 3 3 3 3 2 2 2 3 3 3 3 3 4 4 4 3 3 3 4 4 3 4 3 3 4 4 4 4 4 2 2 2 2 3 3 2 3 3 3 2 2 2 3 3 2 3 3 3 3 3 3 4 4 3 3 4 4 3 4 3 3 3 4 4 3 3 4 4 3 4 2 2 3 3 3 3 3 3 4 4 3 4 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 3 3 3 4 4 3 3 4 4 3 4 3 3 4 4 4 4 4 4 4 4 4 3 3 4 ...
result:
wrong answer 66th numbers differ - expected: '3', found: '2'