제출 #263134

#제출 시각아이디문제언어결과실행 시간메모리
263134ttnhuy313Longest beautiful sequence (IZhO17_subsequence)C++14
컴파일 에러
0 ms0 KiB
#define N 1000001 using namespace std; typedef long long ll; const ll INF = 1e18, MOD = 1e9 + 7, MOD2 = 1e6 + 3; int d[1 << 10][1 << 10][11], p[1 << 10][1 << 10][11], pc[1 << 20]; int a[N], k[N], n, bm = (1 << 10) - 1, ans, par[N], ind; int main () { cin >> n; for (int i = 0; i < (1 << 10); i++) pc[i] = __builtin_popcount (i); memset (p, -1, sizeof (p)); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> k[i]; } for (int i = 0; i < n; i++) { int x = 0; par[i] = -1; for (int j = 0; j < (1 << 10); j++) { int l = k[i] - pc[j & (a[i] >> 10)]; if (l < 0 || l > 10) continue; if (x < d[j][a[i] & bm][l]) { par[i] = p[j][a[i] & bm][l]; x = d[j][a[i] & bm][l]; } } x++; for (int j = 0; j < (1 << 10); j++) { int& c = d[a[i] >> 10][j][pc[j & a[i]]]; if (x > c) { c = x; p[a[i] >> 10][j][pc[j & a[i]]] = i; } } if (x > ans) { ans = x; ind = i; } } vector <int> v; cout << ans << endl; while (ind != -1) { v.push_back (ind + 1); ind = par[ind]; } reverse (v.begin(), v.end()); for (int i : v) cout << i << ' '; }

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

subsequence.cpp: In function 'int main()':
subsequence.cpp:13:2: error: 'cin' was not declared in this scope
   13 |  cin >> n;
      |  ^~~
subsequence.cpp:1:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | #define N 1000001
subsequence.cpp:18:2: error: 'memset' was not declared in this scope
   18 |  memset (p, -1, sizeof (p));
      |  ^~~~~~
subsequence.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | #define N 1000001
subsequence.cpp:57:2: error: 'vector' was not declared in this scope
   57 |  vector <int> v;
      |  ^~~~~~
subsequence.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | #define N 1000001
subsequence.cpp:57:10: error: expected primary-expression before 'int'
   57 |  vector <int> v;
      |          ^~~
subsequence.cpp:59:2: error: 'cout' was not declared in this scope
   59 |  cout << ans << endl;
      |  ^~~~
subsequence.cpp:59:2: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
subsequence.cpp:59:17: error: 'endl' was not declared in this scope
   59 |  cout << ans << endl;
      |                 ^~~~
subsequence.cpp:1:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
  +++ |+#include <ostream>
    1 | #define N 1000001
subsequence.cpp:62:3: error: 'v' was not declared in this scope
   62 |   v.push_back (ind + 1);
      |   ^
subsequence.cpp:66:11: error: 'v' was not declared in this scope
   66 |  reverse (v.begin(), v.end());
      |           ^
subsequence.cpp:66:2: error: 'reverse' was not declared in this scope
   66 |  reverse (v.begin(), v.end());
      |  ^~~~~~~