제출 #722254

#제출 시각아이디문제언어결과실행 시간메모리
722254uroskLongest beautiful sequence (IZhO17_subsequence)C++14
컴파일 에러
0 ms0 KiB
#define here cerr<<"===========================================\n" #define dbg(x) cerr<<#x<<": "<<x<<endl; #include "bits/stdc++.h" //#include <ext/pb_ds/tree_policy.hpp> //#include <ext/pb_ds/assoc_container.hpp> #define ld double #define ll long long #define llinf 100000000000000000LL // 10^17 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pll pair<ll,ll> #define pld pair<ld,ld> #define all(a) a.begin(),a.end() #define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} #define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;} #define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0); using namespace std; //using namespace __gnu_pbds; /* ll add(ll x,ll y){ x+=y; if(x<0){ x%=mod; x+=mod; }else{ if(x>=mod) x%=mod; } return x; } ll mul(ll a,ll b){ ll ans = (a*b)%mod; if(ans<0) ans+=mod; return ans; } ll po(ll x,ll y){ if(y==0) return 1LL; ll ans = po(x,y/2); ans = mul(ans,ans); if(y&1) ans = mul(ans,x); return ans; } ll inv(ll x){return po(x,mod-2);} */ /* typedef tree<int,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; typedef tree<int,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll rnd(ll l,ll r){ return uniform_int_distribution<ll>(l,r)(rng); } */ #define maxn 100005 #define maxx 1025 ll n; ll a[maxn]; ll k[maxn]; pll dp[maxx][maxx][11]; ll mask = (1<<10)-1; ll bc[maxx][maxx]; ll last[maxn]; ll ans = 1; ll ansid = 0; void tc(){ for(ll i = 0;i<=mask;i++) for(ll j = 0;j<=mask;j++) bc[i][j] = __builtin_popcount(i&j); cin >> n; for(ll i = 1;i<=n;i++) cin >> a[i]; for(ll i = 1;i<=n;i++) cin >> k[i]; for(ll i = 1;i<=n;i++){ ll x = a[i]; ll rx = (x>>10) ll lx = x%(1<<10); ll cur = 1; ll curid = i; for(ll l = 0;l<=mask;l++){ if(k[i]-bc[l][lx]>0||k[i]-bc[l][lx]>10) continue; if(dp[l][rx][k[i]-bc[l][lx]].fi+1>cur){ cur = dp[l][rx][k[i]-bc[l][lx]].fi+1; last[i] = dp[l][rx][k[i]-bc[l][lx]].sc; } } for(ll r = 0;r<=mask;r++){ if(dp[lx][r][bc[rx][r]].fi<cur){ dp[lx][r][bc[rx][r]].fi = cur; dp[lx][r][bc[rx][r]].sc = i; } } if(cur>ans){ ansid = i; ans = cur; } } cout<<ans<<endl; vector<ll> v; while(ansid){ v.pb(ansid); ansid = last[ansid]; } reverse(all(v)); for(ll x : v) cout<<x<< " "; cout<<endl; } int main(){ daj_mi_malo_vremena int t; t = 1; while(t--){ tc(); } return 0; } /** 4 1 2 3 4 10 0 1 0 2 8 9 20 0 5 5 3 5 3 5 10 1 20 1 20 **/

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

subsequence.cpp: In function 'void tc()':
subsequence.cpp:7:12: error: expected ',' or ';' before 'long'
    7 | #define ll long long
      |            ^~~~
subsequence.cpp:76:9: note: in expansion of macro 'll'
   76 |         ll lx = x%(1<<10);
      |         ^~
subsequence.cpp:80:27: error: 'lx' was not declared in this scope; did you mean 'l'?
   80 |             if(k[i]-bc[l][lx]>0||k[i]-bc[l][lx]>10) continue;
      |                           ^~
      |                           l
subsequence.cpp:81:37: error: 'lx' was not declared in this scope; did you mean 'l'?
   81 |             if(dp[l][rx][k[i]-bc[l][lx]].fi+1>cur){
      |                                     ^~
      |                                     l
subsequence.cpp:87:19: error: 'lx' was not declared in this scope; did you mean 'rx'?
   87 |             if(dp[lx][r][bc[rx][r]].fi<cur){
      |                   ^~
      |                   rx
subsequence.cpp:78:12: warning: unused variable 'curid' [-Wunused-variable]
   78 |         ll curid = i;
      |            ^~~~~