Submission #1101896

#TimeUsernameProblemLanguageResultExecution timeMemory
1101896vjudge1Museum (CEOI17_museum)C++17
Compilation error
0 ms0 KiB
• #include<bits/stdc++.h> • using namespace std; • const int N = 10000 + 2; • const int inf = 1 << 28; • int sz[N]; • int dp[N][2][N]; • vector<pair<int, int>> g[N]; • void calc_dp(int u, int p) { • sz[u] = 1; • for (auto [v, c]: g[u]) { • if (v == p) continue; • calc_dp(v, u); • sz[u] += sz[v]; • } • for (int i = 0; i <= sz[u]; i++) dp[u][0][i] = dp[u][1][i] = inf; • int len = 1; • dp[u][0][0] = dp[u][1][0] = 0; • dp[u][0][1] = dp[u][1][1] = 0; • for (auto [v, c]: g[u]) { • if (v == p) continue; • • for (int i = len; i >= 0; i--) { • for (int j = 0; j <= min(i, sz[v]); j++) { • dp[u][0][i] = min(dp[u][0][i], dp[u][1][i - j] + dp[v][0][j] + c); • dp[u][0][i] = min(dp[u][0][i], dp[u][0][i - j] + dp[v][1][j] + c + c); • dp[u][1][i] = min(dp[u][1][i], dp[u][1][i - j] + dp[v][1][j] + c + c); • } • }len+= sz[v]; • } • } • void solve() { • int n, k, x; • cin >> n >> k >> x; • for (int i = 2; i <= n; i++) { • int u, v, c; • cin >> u >> v >> c; • g[u].push_back({v, c}); • g[v].push_back({u, c}); • } • calc_dp(x, 0); • cout << dp[x][0][k] << '\n'; • for (int i = 0; i <= n; i++) { • g[i].clear(); • } • } •   • int32_t main() { • ios_base::sync_with_stdio(false);cin.tie(NULL); • solve(); • return 0; • }

Compilation message (stderr)

museum.cpp:1:1: error: extended character • is not valid in an identifier
    1 | • #include<bits/stdc++.h>
      | ^
museum.cpp:1:5: error: stray '#' in program
    1 | • #include<bits/stdc++.h>
      |   ^
museum.cpp:3:1: error: extended character • is not valid in an identifier
    3 | • using namespace std;
      | ^
museum.cpp:5:1: error: extended character • is not valid in an identifier
    5 | • const int N = 10000 + 2;
      | ^
museum.cpp:7:1: error: extended character • is not valid in an identifier
    7 | • const int inf = 1 << 28;
      | ^
museum.cpp:9:1: error: extended character • is not valid in an identifier
    9 | • int sz[N];
      | ^
museum.cpp:11:1: error: extended character • is not valid in an identifier
   11 | • int dp[N][2][N];
      | ^
museum.cpp:13:1: error: extended character • is not valid in an identifier
   13 | • vector<pair<int, int>> g[N];
      | ^
museum.cpp:15:1: error: extended character • is not valid in an identifier
   15 | • void calc_dp(int u, int p) {
      | ^
museum.cpp:17:1: error: extended character • is not valid in an identifier
   17 | •  sz[u] = 1;
      | ^
museum.cpp:19:1: error: extended character • is not valid in an identifier
   19 | •  for (auto [v, c]: g[u]) {
      | ^
museum.cpp:21:1: error: extended character • is not valid in an identifier
   21 | •   if (v == p) continue;
      | ^
museum.cpp:23:1: error: extended character • is not valid in an identifier
   23 | •   calc_dp(v, u);
      | ^
museum.cpp:25:1: error: extended character • is not valid in an identifier
   25 | •   sz[u] += sz[v];
      | ^
museum.cpp:27:1: error: extended character • is not valid in an identifier
   27 | •  }
      | ^
museum.cpp:29:1: error: extended character • is not valid in an identifier
   29 | •  for (int i = 0; i <= sz[u]; i++) dp[u][0][i] = dp[u][1][i] = inf;
      | ^
museum.cpp:31:1: error: extended character • is not valid in an identifier
   31 | •  int len = 1;
      | ^
museum.cpp:33:1: error: extended character • is not valid in an identifier
   33 | •  dp[u][0][0] = dp[u][1][0] = 0;
      | ^
museum.cpp:35:1: error: extended character • is not valid in an identifier
   35 | •  dp[u][0][1] = dp[u][1][1] = 0;
      | ^
museum.cpp:37:1: error: extended character • is not valid in an identifier
   37 | •  for (auto [v, c]: g[u]) {
      | ^
museum.cpp:39:1: error: extended character • is not valid in an identifier
   39 | •   if (v == p) continue;
      | ^
museum.cpp:41:1: error: extended character • is not valid in an identifier
   41 | •
      | ^
museum.cpp:43:1: error: extended character • is not valid in an identifier
   43 | •   for (int i = len; i >= 0; i--) {
      | ^
museum.cpp:45:1: error: extended character • is not valid in an identifier
   45 | •    for (int j = 0; j <= min(i, sz[v]); j++) {
      | ^
museum.cpp:47:1: error: extended character • is not valid in an identifier
   47 | •     dp[u][0][i] = min(dp[u][0][i], dp[u][1][i - j] + dp[v][0][j] + c);
      | ^
museum.cpp:49:1: error: extended character • is not valid in an identifier
   49 | •     dp[u][0][i] = min(dp[u][0][i], dp[u][0][i - j] + dp[v][1][j] + c + c);
      | ^
museum.cpp:51:1: error: extended character • is not valid in an identifier
   51 | •     dp[u][1][i] = min(dp[u][1][i], dp[u][1][i - j] + dp[v][1][j] + c + c);
      | ^
museum.cpp:53:1: error: extended character • is not valid in an identifier
   53 | •    }
      | ^
museum.cpp:55:1: error: extended character • is not valid in an identifier
   55 | •   }len+= sz[v];
      | ^
museum.cpp:57:1: error: extended character • is not valid in an identifier
   57 | •  }
      | ^
museum.cpp:59:1: error: extended character • is not valid in an identifier
   59 | • }
      | ^
museum.cpp:61:1: error: extended character • is not valid in an identifier
   61 | • void solve() {
      | ^
museum.cpp:63:1: error: extended character • is not valid in an identifier
   63 | •  int n, k, x;
      | ^
museum.cpp:65:1: error: extended character • is not valid in an identifier
   65 | •  cin >> n >> k >> x;
      | ^
museum.cpp:67:1: error: extended character • is not valid in an identifier
   67 | •  for (int i = 2; i <= n; i++) {
      | ^
museum.cpp:69:1: error: extended character • is not valid in an identifier
   69 | •   int u, v, c;
      | ^
museum.cpp:71:1: error: extended character • is not valid in an identifier
   71 | •   cin >> u >> v >> c;
      | ^
museum.cpp:73:1: error: extended character • is not valid in an identifier
   73 | •   g[u].push_back({v, c});
      | ^
museum.cpp:75:1: error: extended character • is not valid in an identifier
   75 | •   g[v].push_back({u, c});
      | ^
museum.cpp:77:1: error: extended character • is not valid in an identifier
   77 | •  }
      | ^
museum.cpp:79:1: error: extended character • is not valid in an identifier
   79 | •  calc_dp(x, 0);
      | ^
museum.cpp:81:1: error: extended character • is not valid in an identifier
   81 | •  cout << dp[x][0][k] << '\n';
      | ^
museum.cpp:83:1: error: extended character • is not valid in an identifier
   83 | •  for (int i = 0; i <= n; i++) {
      | ^
museum.cpp:85:1: error: extended character • is not valid in an identifier
   85 | •   g[i].clear();
      | ^
museum.cpp:87:1: error: extended character • is not valid in an identifier
   87 | •  }
      | ^
museum.cpp:89:1: error: extended character • is not valid in an identifier
   89 | • }
      | ^
museum.cpp:91:1: error: extended character • is not valid in an identifier
   91 | •  
      | ^
museum.cpp:91:5: error: extended character   is not valid in an identifier
   91 | •  
      |   ^
museum.cpp:93:1: error: extended character • is not valid in an identifier
   93 | • int32_t main() {
      | ^
museum.cpp:95:1: error: extended character • is not valid in an identifier
   95 | • ios_base::sync_with_stdio(false);cin.tie(NULL);
      | ^
museum.cpp:97:1: error: extended character • is not valid in an identifier
   97 | • solve();
      | ^
museum.cpp:99:1: error: extended character • is not valid in an identifier
   99 | • return 0;
      | ^
museum.cpp:101:1: error: extended character • is not valid in an identifier
  101 | • }
      | ^
museum.cpp:1:1: error: '\U00002022' does not name a type
    1 | • #include<bits/stdc++.h>
      | ^
museum.cpp:5:1: error: '\U00002022' does not name a type
    5 | • const int N = 10000 + 2;
      | ^
museum.cpp:7:1: error: '\U00002022' does not name a type
    7 | • const int inf = 1 << 28;
      | ^
museum.cpp:9:1: error: '\U00002022' does not name a type
    9 | • int sz[N];
      | ^
museum.cpp:11:1: error: '\U00002022' does not name a type
   11 | • int dp[N][2][N];
      | ^
museum.cpp:13:1: error: '\U00002022' does not name a type
   13 | • vector<pair<int, int>> g[N];
      | ^
museum.cpp:15:1: error: '\U00002022' does not name a type
   15 | • void calc_dp(int u, int p) {
      | ^
museum.cpp:61:1: error: '\U00002022' does not name a type
   61 | • void solve() {
      | ^
museum.cpp:91:1: error: '\U00002022' does not name a type
   91 | •  
      | ^