QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#199691 | #5147. Stack Sort | PHarr# | WA | 34ms | 3620kb | C++20 | 518b | 2023-10-04 13:44:51 | 2023-10-04 13:44:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using vi = vector<int>;
void solve() {
int n;
multiset<int> s;
cin >> n;
for (int x; n; n--) {
cin >> x;
if (s.count(x + 1) > 0) {
s.erase(s.lower_bound(x - 1));
}
s.insert(x);
}
cout << s.size() << "\n";
}
int32_t main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int TC;
for (cin >> TC; TC; TC--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
3 3 1 2 3 3 3 2 1 5 1 4 2 5 3
output:
3 1 4
result:
ok 3 number(s): "3 1 4"
Test #2:
score: -100
Wrong Answer
time: 34ms
memory: 3508kb
input:
100000 4 3 4 2 1 5 5 4 1 3 2 4 3 1 4 2 4 4 2 1 3 4 1 3 2 4 4 4 2 3 1 4 3 2 1 4 5 1 2 3 4 5 5 5 2 3 1 4 5 1 3 5 4 2 5 4 3 2 1 5 5 3 4 2 1 5 5 5 4 3 2 1 4 3 4 2 1 5 4 2 5 1 3 5 4 1 5 2 3 4 3 4 1 2 4 2 1 3 4 5 4 3 2 5 1 4 4 2 1 3 5 3 1 5 2 4 4 4 1 2 3 5 1 5 2 4 3 5 4 1 3 5 2 5 4 2 3 5 1 5 1 2 3 4 5 5 4...
output:
2 2 3 2 3 3 2 5 3 4 2 3 1 2 3 4 3 3 2 2 3 3 3 3 4 5 4 3 4 3 3 3 3 3 3 2 3 4 2 4 3 2 4 2 3 4 2 3 3 2 4 3 2 3 2 3 2 3 3 4 3 3 3 3 2 3 2 2 4 3 3 2 2 3 3 3 3 3 2 2 3 4 3 3 4 3 4 3 3 3 4 3 3 4 3 2 3 4 3 3 2 4 3 4 2 1 4 2 3 3 2 3 2 2 4 3 2 2 2 3 3 2 4 4 2 3 2 2 3 3 3 3 2 4 3 2 4 3 3 3 3 4 3 2 1 3 3 4 3 3 ...
result:
wrong answer 6th numbers differ - expected: '2', found: '3'