Submission #847673

#TimeUsernameProblemLanguageResultExecution timeMemory
847673willychanCollecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
1 ms344 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; //#include<bits/extc++.h> //__gnu_pbds int main(){ ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n,L; cin>>n>>L; int x[n]; int t[n]; for(int i=0;i<n;i++) cin>>x[i]; for(int i=0;i<n;i++) cin>>t[i]; int mans = 0; for(int i=0;i<n;i++){ int ans = 0; for(int r=0;r<=i;r++){ if(t[r]-x[r]>=0) ans++; } for(int l=n-1;l>=i+1;l--){ if(t[l]-L+x[l]>=2*x[i]) ans++; } mans = max(ans,mans); } for(int i=n-1;i>=0;i--){ int ans = 0; for(int r = n-1;r>=i;r--){ if(t[r]-L+x[r]>=0) ans++; } for(int l=0;l<i;l++){ if(t[l]-x[l]>=2*(L-x[i])) ans++; } mans = max(ans,mans); } cout<<mans<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...