Submission #230095

#TimeUsernameProblemLanguageResultExecution timeMemory
230095AMO5Collecting Stamps 3 (JOI20_ho_t3)C++98
0 / 100
5 ms384 KiB
// READ & UNDERSTAND // ll, int overflow, array bounds, memset(0) // special cases (n=1?), n+1 (1-index) // do smth instead of nothing & stay organized // WRITE STUFF DOWN #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define MOD 1000000007 typedef long long ll; typedef pair <int, int> ii; typedef pair <ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef long double ld; ll INF=LLONG_MAX; int main() { ios_base::sync_with_stdio(0); cin.tie(0); //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n; cin >> n; ll L; cin >> L; ll x[n+n],t[n+n]; for(int i=0; i<n; i++){ cin >> x[i]; } int ans = 0; for(int i=0; i<n; i++){ cin >> t[i]; if(x[i]<=t[i])ans++; } vi now; for(int i=0; i<n; i++){ if(L-x[i]<=t[i])now.pb(i); } for(int i=0; i<(int)now.size(); i++){ int cur = now[i]; int cnt = 0; ll doub = (L-x[cur])*2; for(int j=0; j<cur; j++){ if(doub+x[j]<=t[j])cnt++; } ans = max(ans,cnt+(int)now.size()-i); } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...