제출 #535319

#제출 시각아이디문제언어결과실행 시간메모리
535319BiazCollecting Stamps 3 (JOI20_ho_t3)C++17
컴파일 에러
0 ms0 KiB
#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; for (int i=0;i<=rev;i++){ if (tmp[L-i]!=-1&&tmp[L-i]>=i) tot++,tmp[L-i]=-1; } for (int i=1;i<=L-rev;i++){ if (tmp[i]!=-1&&tmp[i]>=rev*2+i) tot++,tmp[i]=-1; } ans=max(ans,tot); //cout <<rev<<' '<<tot<<'\n'; } for (int wlk=0;wlk<=L;wlk++){ for (int i=0;i<=L;i++) tmp[i]=t[i]; int tot=0; for (int i=0;i<=wlk;i++){ if (tmp[i]!=-1&&tmp[i]>=i){ tot++,tmp[i]=-1; //if (wlk==2) cout <<i<<' '<<tot<<'\n'; } } for (int i=1;i<=L-wlk;i++){ if (tmp[L-i]!=-1&&tmp[L-i]>=wlk*2+i){ tot++,tmp[L-i]=-1; //if (wlk==2) cout <<wlk*2+i<<' '<<tot<<'\n'; } } ans=max(ans,tot); //cout <<wlk<<' '<<tot<<'\n'; } cout <<ans<<'\n'; } signed main(){ int _=1; //cin >>_; while (_--) sol(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

ho_t3.cpp: In function 'void sol()':
ho_t3.cpp:23:19: error: expected ';' before 'for'
   23 |     fill(t,t+N,-1)
      |                   ^
      |                   ;
   24 |     for (int i=0;i<n;i++) cin >>a[i];
      |     ~~~            
ho_t3.cpp:24:18: error: 'i' was not declared in this scope
   24 |     for (int i=0;i<n;i++) cin >>a[i];
      |                  ^