# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
535323 | 2022-03-10T02:44:29 Z | Biaz | Collecting Stamps 3 (JOI20_ho_t3) | C++14 | 0 ms | 212 KB |
#include<bits/stdc++.h> //#define int long long #define pb push_back #define ALL(x) x.begin(),x.end() #define fi first #define se second #define ist insert using namespace std; int min(int a,int b){return a<b?a:b;} int max(int a,int b){return a>b?a:b;} typedef long long ll; typedef pair<ll,ll> pii; const int N=205; const int MOD=1000000007;//998244353 const int INF=2147483647;//1700000000000000000 int n,L; int a[N]; int t[N]; int tmp[N]; inline void sol(){ cin >>n>>L; fill(t,t+N,-1); for (int i=0;i<n;i++) cin >>a[i]; for (int i=0,k;i<n;i++) cin >>k,t[a[i]]=k; int ans=0; for (int rev=0;rev<=L;rev++){ for (int i=0;i<=L;i++) tmp[i]=t[i]; int tot=0,cur=0,tim=0; for (int i=L-1;i>=L-rev;i--){ tim++; if (tmp[i]!=-1&&tmp[i]>=tim){ tot++;tmp[i]=-1; } } for (int i=1;i<=rev;i++){ tim++; } for (int i=1;i<=L;i++){ tim++; if (tmp[i]!=-1&&tmp[i]>=tim){ tot++;tmp[i]=-1; } } ans=max(ans,tot); } for (int rev=0;rev<=L;rev++){ for (int i=0;i<=L;i++) tmp[i]=t[i]; int tot=0,cur=0,tim=0; for (int i=1;i<=rev;i++){ tim++; if (tmp[i]!=-1&&tmp[i]>=tim){ tot++;tmp[i]=-1; } } for (int i=1;i<=rev;i++){ tim++; } for (int i=L-1;i>=0;i--){ tim++; if (tmp[i]!=-1&&tmp[i]>=tim){ tot++;tmp[i]=-1; } } ans=max(ans,tot); } cout <<ans<<'\n'; } signed main(){ int _=1; //cin >>_; while (_--) sol(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |