제출 #1112959

#제출 시각아이디문제언어결과실행 시간메모리
1112959adiyerLongest beautiful sequence (IZhO17_subsequence)C++17
컴파일 에러
0 ms0 KiB
// #pragma optimize ("g",on) // #pragma GCC optimize("inline") // #pragma GCC optimize ("Ofast") // #pragma GCC optimize ("unroll-loops") // #pragma GCC optimize ("03") #include <bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); #define pb push_back using namespace std; typedef long long ll; const int N = 1e5 + 2; const int M = (1 << 8); ll n, pos; ll a[N], k[N], dp[N]; void sol(){ cin >> n, pos = 1; 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++){ dp[i] = 1; for(ll j = 1; j < i; j++) if((__builtin_popcount(a[j] & a[i]) == k[i])) dp[i] = max(dp[i], dp[j] + 1); if(dp[i] > dp[pos]) pos = i; // cout << dp[i] << '\n'; } vector < ll > ans; ans.pb(pos); while(pos > 1){ for(ll i = pos - 1; i >= 1; i--){ if(__builtin_popcountll(a[pos] & a[i]) == k[pos] && dp[pos] == dp[i] + 1){ pos = i; break; } } ans.pb(pos); if(len(ans)) == ans[0]) break; } reverse(ans.begin(), ans.end()); cout << ans.size() << '\n'; for(ll x : ans) cout << x << ' '; } signed main(){ ios sol(); // slow(); // stress(); }

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

subsequence.cpp: In function 'void sol()':
subsequence.cpp:44:6: error: 'len' was not declared in this scope
   44 |   if(len(ans)) == ans[0]) break;
      |      ^~~
subsequence.cpp:44:16: error: expected primary-expression before '==' token
   44 |   if(len(ans)) == ans[0]) break;
      |                ^~