Submission #1206586

#TimeUsernameProblemLanguageResultExecution timeMemory
1206586lopkusThe short shank; Redemption (BOI21_prison)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int __int64 void solve() { int n, d, t; std::cin >> n >> d >> t; std::vector<int> a(n + 1); for(int i = 1; i <= n; i++) { std::cin >> a[i]; } std::vector<std::vector<int>> dp(n + 1, std::vector<int>(d + 1, n + 1)); dp[0][0] = 0; std::vector<int> c = a; c[0] = 1e18; for(int i = 1; i <= n; i++) { c[i] = std::min(c[i], c[i - 1] + 1); dp[i][0] = dp[i - 1][0]; if(c[i] <= t) { dp[i][0] += 1; } } a[0] = 1e18; for(int i = 1; i <= n; i++) { for(int c = 1; c <= d; c++) { for(int j = i; j >= 1; j--) { std::vector<int> b = a; for(int x = j + 1; x <= i; x++) { b[x] = std::min(b[x], b[x - 1] + 1); } int cnt = 0; for(int x = j; x <= i; x++) { if(b[x] <= t) { cnt += 1; } } dp[i][c] = std::min(dp[i][c], dp[j - 1][c - 1] + cnt); } } } std::cout << dp[n][d]; } signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t = 1; //std::cin >> t; while (t--) { solve(); } return 0; }

Compilation message (stderr)

prison.cpp: In function 'void solve()':
prison.cpp:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
prison.cpp:6:3: note: in expansion of macro 'int'
    6 |   int n, d, t;
      |   ^~~
prison.cpp:7:15: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   std::cin >> n >> d >> t;
      |               ^
      |               yn
prison.cpp:7:20: error: 'd' was not declared in this scope
    7 |   std::cin >> n >> d >> t;
      |                    ^
prison.cpp:7:25: error: 't' was not declared in this scope; did you mean 'tm'?
    7 |   std::cin >> n >> d >> t;
      |                         ^
      |                         tm
prison.cpp:8:18: error: template argument 2 is invalid
    8 |   std::vector<int> a(n + 1);
      |                  ^
prison.cpp:9:11: error: expected ';' before 'i'
    9 |   for(int i = 1; i <= n; i++) {
      |           ^
prison.cpp:9:18: error: 'i' was not declared in this scope
    9 |   for(int i = 1; i <= n; i++) {
      |                  ^
prison.cpp:3:13: error: template argument 2 is invalid
    3 | #define int __int64
      |             ^~~~~~~
prison.cpp:12:27: note: in expansion of macro 'int'
   12 |   std::vector<std::vector<int>> dp(n + 1, std::vector<int>(d + 1, n + 1));
      |                           ^~~
prison.cpp:12:30: error: template argument 1 is invalid
   12 |   std::vector<std::vector<int>> dp(n + 1, std::vector<int>(d + 1, n + 1));
      |                              ^~
prison.cpp:12:30: error: template argument 2 is invalid
prison.cpp:12:58: error: template argument 2 is invalid
   12 |   std::vector<std::vector<int>> dp(n + 1, std::vector<int>(d + 1, n + 1));
      |                                                          ^
prison.cpp:12:73: error: expression list treated as compound expression in initializer [-fpermissive]
   12 |   std::vector<std::vector<int>> dp(n + 1, std::vector<int>(d + 1, n + 1));
      |                                                                         ^
prison.cpp:13:5: error: invalid types 'int[int]' for array subscript
   13 |   dp[0][0] = 0;
      |     ^
prison.cpp:14:18: error: template argument 2 is invalid
   14 |   std::vector<int> c = a;
      |                  ^
prison.cpp:15:4: error: invalid types 'int[int]' for array subscript
   15 |   c[0] = 1e18;
      |    ^
prison.cpp:16:11: error: expected ';' before 'i'
   16 |   for(int i = 1; i <= n; i++) {
      |           ^
prison.cpp:16:18: error: 'i' was not declared in this scope
   16 |   for(int i = 1; i <= n; i++) {
      |                  ^
prison.cpp:23:4: error: invalid types 'int[int]' for array subscript
   23 |   a[0] = 1e18;
      |    ^
prison.cpp:24:11: error: expected ';' before 'i'
   24 |   for(int i = 1; i <= n; i++) {
      |           ^
prison.cpp:24:18: error: 'i' was not declared in this scope
   24 |   for(int i = 1; i <= n; i++) {
      |                  ^
prison.cpp:25:13: error: expected ';' before 'c'
   25 |     for(int c = 1; c <= d; c++) {
      |             ^
prison.cpp:26:15: error: expected ';' before 'j'
   26 |       for(int j = i; j >= 1; j--) {
      |               ^
prison.cpp:26:22: error: 'j' was not declared in this scope
   26 |       for(int j = i; j >= 1; j--) {
      |                      ^
prison.cpp:27:24: error: template argument 2 is invalid
   27 |         std::vector<int> b = a;
      |                        ^
prison.cpp:28:17: error: expected ';' before 'x'
   28 |         for(int x = j + 1; x <= i; x++) {
      |                 ^
prison.cpp:28:28: error: 'x' was not declared in this scope
   28 |         for(int x = j + 1; x <= i; x++) {
      |                            ^
prison.cpp:31:13: error: expected ';' before 'cnt'
   31 |         int cnt = 0;
      |             ^~~
prison.cpp:32:17: error: expected ';' before 'x'
   32 |         for(int x = j; x <= i; x++) {
      |                 ^
prison.cpp:32:24: error: 'x' was not declared in this scope
   32 |         for(int x = j; x <= i; x++) {
      |                        ^
prison.cpp:34:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   34 |             cnt += 1;
      |             ^~~
      |             int
prison.cpp:37:58: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |         dp[i][c] = std::min(dp[i][c], dp[j - 1][c - 1] + cnt);
      |                                                          ^~~
      |                                                          int
prison.cpp: In function 'int main()':
prison.cpp:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
prison.cpp:48:3: note: in expansion of macro 'int'
   48 |   int t = 1;
      |   ^~~
prison.cpp:50:10: error: 't' was not declared in this scope; did you mean 'tm'?
   50 |   while (t--) {
      |          ^
      |          tm