# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
674732 |
2022-12-26T04:48:58 Z |
QwertyPi |
Arcade (NOI20_arcade) |
C++14 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
using namespace std;
const int MAXM = 5e5 + 11;
int t[MAXM], a[MAXM];
int32_t main(){
cin.tie(0); cout.tie(0)->sync_with_stdio(false);
int n, m; cin >> n >> m;
for(int i = 0; i < m; i++) cin >> t[i];
for(int i = 0; i < m; i++) cin >> a[i];
vector<pair<int, int>> v;
for(int i = 0; i < m; i++) v.push_back({a[i] - t[i], a[i] + t[i]});
sort(v.begin(), v.end(), [](pair<int, int> x, pair<int, int> y){
return x.fi < y.fi || x.fi == y.fi && x.se > y.se;
});
set<int> s; s.insert(1LL << 60);
for(auto i : v){
auto ptr = s.upper_bound(i.se);
if(ptr != s.begin()) {
s.erase(prev(ptr));
s.insert(i.se);
}else{
s.insert(i.se);
}
}
cout << s.size() - 1 << endl;
}
Compilation message
Arcade.cpp: In lambda function:
Arcade.cpp:19:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
19 | return x.fi < y.fi || x.fi == y.fi && x.se > y.se;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |