This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define int long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/STACK: 20000000005")
*/
using namespace std;
const int N = 300005, MOD = 1e9+7;
int n;
pair < int, int > P[N];
set < int > S;
set < int >::iterator I;
main()
{
//freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin >> n >> n;
for (int i = 1; i <= n; i++)
cin >> P[i].F;
for (int i = 1; i <= n; i++)
cin >> P[i].S;
for (int i = 1; i <= n; i++){
int x = P[i].F - P[i].S, y = P[i].F + P[i].S;
P[i] = {x, y};
}
sort (P+1, P+n+1);
for (int i = 1; i <= n; i++){
I = S.upper_bound (P[i].S);
if (I == S.begin()){
S.insert (P[i].S);
continue;
}
I--;
S.erase (I);
S.insert (P[i].S);
}
cout << (int)S.size() << endl;
}
Compilation message (stderr)
Arcade.cpp:18: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
18 | #pragma GCC optimization ("unroll-loops")
|
Arcade.cpp:41:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
41 | main()
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |