#include <bits/stdc++.h>
using namespace std;
int main () {
int q;
cin >> q;
vector<int> a;
while(q--){
int j, v;
cin >> j >> v;
a.insert(a.begin()+j-1, v);
multiset<int> s;
for(int i:a) {
s.insert(i);
auto it = s.lower_bound(i);
it++;
if(it != s.end()) {
s.erase(it);
}
}
cout << s.size() << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
63 ms |
448 KB |
Output is correct |
4 |
Correct |
82 ms |
444 KB |
Output is correct |
5 |
Correct |
60 ms |
348 KB |
Output is correct |
6 |
Correct |
79 ms |
344 KB |
Output is correct |
7 |
Correct |
73 ms |
348 KB |
Output is correct |
8 |
Correct |
74 ms |
348 KB |
Output is correct |
9 |
Correct |
81 ms |
344 KB |
Output is correct |
10 |
Correct |
71 ms |
348 KB |
Output is correct |
11 |
Correct |
77 ms |
348 KB |
Output is correct |
12 |
Correct |
76 ms |
348 KB |
Output is correct |
13 |
Correct |
95 ms |
444 KB |
Output is correct |
14 |
Correct |
93 ms |
344 KB |
Output is correct |
15 |
Correct |
79 ms |
344 KB |
Output is correct |
16 |
Correct |
89 ms |
344 KB |
Output is correct |
17 |
Correct |
91 ms |
344 KB |
Output is correct |
18 |
Correct |
94 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
63 ms |
448 KB |
Output is correct |
4 |
Correct |
82 ms |
444 KB |
Output is correct |
5 |
Correct |
60 ms |
348 KB |
Output is correct |
6 |
Correct |
79 ms |
344 KB |
Output is correct |
7 |
Correct |
73 ms |
348 KB |
Output is correct |
8 |
Correct |
74 ms |
348 KB |
Output is correct |
9 |
Correct |
81 ms |
344 KB |
Output is correct |
10 |
Correct |
71 ms |
348 KB |
Output is correct |
11 |
Correct |
77 ms |
348 KB |
Output is correct |
12 |
Correct |
76 ms |
348 KB |
Output is correct |
13 |
Correct |
95 ms |
444 KB |
Output is correct |
14 |
Correct |
93 ms |
344 KB |
Output is correct |
15 |
Correct |
79 ms |
344 KB |
Output is correct |
16 |
Correct |
89 ms |
344 KB |
Output is correct |
17 |
Correct |
91 ms |
344 KB |
Output is correct |
18 |
Correct |
94 ms |
348 KB |
Output is correct |
19 |
Execution timed out |
4030 ms |
552 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |