제출 #1136046

#제출 시각아이디문제언어결과실행 시간메모리
1136046bpptidpTable Tennis (info1cup20_tabletennis)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; const int N=1.5e5,K=405; int a[N+K],dp[K][K],n,k; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n>>k; for(int i=0;i<n+k;++i) cin>>a[i]; //O(nk+k^4) unordered_map<int,int>occ; int f=[](int x){return min(n+k-x-1,404);}; for(int fi=0;fi<=k;++fi){ int se=fi+n-1,x=a[fi]+a[se],c=2; for(int i=fi+1;i<se;++i) ++occ[a[i]]; for(int i=fi+1;i<se;++i){ if(2*a[i]>x)break; if(2*a[i]==x){ if(occ[a[i]]<2)continue; c+=2; occ[a[i]]-=2; }else if(occ[x-a[i]]){ c+=2; --occ[x-a[i]]; --occ[a[i]]; } } dp[fi][f(se)]=c; } for(int len=n+1;len<=n+k;++len){ for(int fi=0;fi+len<=n+k;++fi){ int se=fi+len-1,x=a[fi]+a[se],mx=0; for(int i=fi+1;i+n-1<=se+1;++i){ for(int j=se-1;j-n+1>=fi-3;--j){ if(i<=fi||i>=se||j<=fi||j>=se)continue; if(a[i]+a[j]!=x)continue; mx=max(mx,dp[i][f(j)]); } } dp[fi][f(se)]=max(dp[fi][f(se)],1+mx); } } //iskreno mrzi me da kucam do kraja sad //al trebalo bi da daje nekih 87 ovo cout<<87; }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:20:45: error: invalid user-defined conversion from 'main()::<lambda(int)>' to 'int' [-fpermissive]
   20 |     int f=[](int x){return min(n+k-x-1,404);};
      |                                             ^
tabletennis.cpp:20:11: note: candidate is: 'constexpr main()::<lambda(int)>::operator int (*)(int)() const' (near match)
   20 |     int f=[](int x){return min(n+k-x-1,404);};
      |           ^
tabletennis.cpp:20:11: note:   no known conversion from 'int (*)(int)' to 'int'
tabletennis.cpp:38:25: error: 'f' cannot be used as a function
   38 |                 dp[fi][f(se)]=c;
      |                        ~^~~~
tabletennis.cpp:48:50: error: 'f' cannot be used as a function
   48 |                                 mx=max(mx,dp[i][f(j)]);
      |                                                 ~^~~
tabletennis.cpp:51:25: error: 'f' cannot be used as a function
   51 |                 dp[fi][f(se)]=max(dp[fi][f(se)],1+mx);
      |                        ~^~~~
tabletennis.cpp:51:43: error: 'f' cannot be used as a function
   51 |                 dp[fi][f(se)]=max(dp[fi][f(se)],1+mx);
      |                                          ~^~~~