# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891838 |
2023-12-24T08:05:57 Z |
CDuong |
Arcade (NOI20_arcade) |
C++17 |
|
0 ms |
348 KB |
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;
const int mxN = 5e5 + 5;
const int mod = 1e9 + 7;
const i64 oo = 1e18;
int n, m;
vector<pair<int, int>> v;
void solve() {
cin >> n >> m;
v.resize(m + 1);
for (int i = 1; i <= m; ++i) cin >> v[i].ff;
for (int i = 1; i <= m; ++i) cin >> v[i].ss;
sort(v.begin() + 1, v.end());
int cnt = 1;
set<pair<int, int>> s;
for (int i = 1; i <= m; ++i) {
auto it = s.lower_bound({v[i].ss, v[i].ff});
bool woo = true;
if (it != s.end()) {
woo &= abs(it->ff - v[i].ss) >= abs(it->ss - v[i].ff);
}
if (it != s.begin()) {
it = prev(it);
woo &= abs(it->ff - v[i].ss) >= abs(it->ss - v[i].ff);
}
if (!woo) {
++cnt;
s.clear();
}
s.insert({v[i].ss, v[i].ff});
}
cout << cnt << endl;
}
signed main() {
#ifndef CDuongg
if(fopen(taskname".inp", "r"))
assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
freopen("bai3.inp", "r", stdin);
freopen("bai3.out", "w", stdout);
auto start = chrono::high_resolution_clock::now();
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1; //cin >> t;
while(t--) solve();
#ifdef CDuongg
auto end = chrono::high_resolution_clock::now();
cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
cout << "Check array size pls sir" << endl;
#endif
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |