제출 #133859

#제출 시각아이디문제언어결과실행 시간메모리
133859KastandaLongest beautiful sequence (IZhO17_subsequence)C++11
컴파일 에러
0 ms0 KiB
// ItnoE #include<bits/stdc++.h> using namespace std; const int N = 100005, SQ = 1024; int n, A[N], P[N]; pair < int , int > dp[21][SQ][SQ]; inline void Max(pair < int , int > &a, pair < int , int > b) {a = max(a, b);} int main() { scanf("%d", &n); for (int i = 1; i <= n; i ++) scanf("%d", &A[i]); int Mx = 0, Bi = 0; for (int i = 1; i <= n; i ++) { int k, a = A[i]; scanf("%d", &k); pair < int , int > Bst = {0, 0}; for (int j = 0; j < SQ; j ++) if (k >= __builtin_popcount(a >> 10 & j)) Max(Bst, dp[k - __builtin_popcount(a >> 10 & j)][a & 1023][j]); P[i] = Bst.second; Bst.first ++; Bst.second = i; for (int j = 0; j < SQ; j ++) Max(dp[__builtin_popcount(a & j)][j][a >> 10], Bst); if (Bst.first > Mx) Mx = Bst.first, Bi = i; } vector < int > R; while (Bi) R.push_back(Bi), Bi = P[Bi]; reverse(R.begin(), R.end() printf("%d\n", (int)R.size()); for (int v : R) printf("%d ", v); return 0; }

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

subsequence.cpp: In function 'int main()':
subsequence.cpp:32:5: error: expected ')' before 'printf'
     printf("%d\n", (int)R.size());
     ^~~~~~
subsequence.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
subsequence.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &A[i]);
         ~~~~~^~~~~~~~~~~~~
subsequence.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &k);
         ~~~~~^~~~~~~~~~