Submission #935743

#TimeUsernameProblemLanguageResultExecution timeMemory
935743fdnfksdArcade (NOI20_arcade)C++14
0 / 100
1 ms4444 KiB
#include<bits/stdc++.h> #define pb push_back #define pli pair<int,int> #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; using ll=long long; const ll maxn=2e5; const ll inf=1e18; const ll mod=1e9+7; ll n,m,t[maxn],a[maxn],e[maxn]; pli b[maxn]; void solve() { cin >> m >> n; for(int i=1;i<=n;i++) cin >> t[i]; for(int i=1;i<=n;i++) cin >> a[i]; for(int i=1;i<=n;i++) { b[i].fi=a[i]-t[i]; b[i].se=a[i]+t[i]; } sort(b+1,b+n+1); ll sz=0; for(int i=1;i<=n;i++) { ll low=1,high=sz; while(low<=high) { ll mid=low+high>>1; if(e[mid]<=b[i].se) high=mid-1; else low=mid+1; } if(low>sz) sz++; e[low]=b[i].se; } cout << sz; } int main() { fastio //freopen(TASKNAME".INP","r",stdin); //freopen(TASKNAME".OUT","w",stdout); solve(); }

Compilation message (stderr)

Arcade.cpp: In function 'void solve()':
Arcade.cpp:31:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |             ll mid=low+high>>1;
      |                    ~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...