Submission #940909

#TimeUsernameProblemLanguageResultExecution timeMemory
940909LittleOrangeCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(0);cin.tie(0); ll n,l; cin >> n >> l; vector<ll> x(n),t(n); for(ll &i : x) cin >> i; for(ll &i : t) cin >> i; vector<ll> rx(n),rt(n); for(ll i = 0;i<n;i++){ rx[i] = l-x[n-1-i]; rt[i] = t[n-1-i]; } ll ans = 0; { ll cur = 0; for(ll i = 0;i<n;i++) cur += t[i]>=x[i]; ans = max(ans,cur); } { ll cur = 0; for(ll i = 0;i<n;i++) cur += rt[i]>=rx[i]; ans = max(ans,cur); } for(ll i = 0;i<n;i++){ ll w = x[i]; ll cur = 0; for(ll j = 0;j<=i;j++) cur += t[j]>=x[j]; w*=2; for(ll j = 0;j+i<n-1;j++) cur += rt[j]>=rx[j]+w; ans = max(ans,cur); } for(ll i = 0;i<n;i++){ ll w = rx[i]; ll cur = 0; for(ll j = 0;j<=i;j++) cur += rt[j]>=rx[j]; w*=2; for(ll j = 0;j+i<n-1;j++) cur += t[j]>=x[j]+w; ans = max(ans,cur); } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...