Submission #481742

#TimeUsernameProblemLanguageResultExecution timeMemory
481742LoboCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; const long long INFll = (long long) 1e18 + 10; const int INFii = (int) 1e9 + 10; typedef long long ll; typedef int ii; typedef long double dbl; #define endl '\n' #define sc second #define fr first #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() #define maxn 220 ii n, l, t[maxn], x[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(0); //freopen("in.in", "r", stdin); //freopen("out.out", "w", stdout); cin >> n >> l; for(ii i = 1; i <= n; i++) { cin >> x[i]; } vector<ii> v1,v2; for(ii i = 1; i <= n; i++) { cin >> t[i]; } ii ans = 0; //sentido normal for(ii i = 0; i <= n; i++) { ii ans1 = 0; for(ii j = 1; j <= i; j++) { if(x[j] <= t[j]) ans1++; } for(ii j = i+1; j <= n; j++) { if(2*x[i]+ (l-x[j]) <= t[j]) ans1++; } ans = max(ans,ans1); } //inverto o sentido for(ii i = 1; i <= n; i++) { x[i] = l-x[i]; } reverse(x+1,x+1+n); reverse(t+1,t+1+n); //sentido inverso //sentido normal for(ii i = 0; i <= n; i++) { ii ans1 = 0; for(ii j = 1; j <= i; j++) { if(x[j] <= t[j]) ans1++; } for(ii j = i+1; j <= n; j++) { if(2*x[i]+ (l-x[j]) <= t[j]) ans1++; } ans = max(ans,ans1); } 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...