제출 #1033912

#제출 시각아이디문제언어결과실행 시간메모리
1033912trucmaiTrains (BOI24_trains)C++17
컴파일 에러
0 ms0 KiB
ll add(ll x, ll y) { return (x + y % MOD) % MOD; } ll sub(ll x, ll y) { return (x - y % MOD + MOD) % MOD; } ll mul(ll x, ll y) { return (x * y) % MOD; } void upd(ll& x, ll y) { x = add(x, y); } ll dp[N], d[N], x[N]; const int BS = 350; ll sum[N][BS]; signed main() { cin.tie(0)->sync_with_stdio(0); auto solver = [&]() { cin >> n; for (int i = 1; i <= n; ++i) cin >> d[i] >> x[i]; for (int i = n; i >= 1; --i) { dp[i] = 1; if (d[i] > BS) { for (int j = 1; j <= x[i]; ++j) { if (i + d[i] * j > n) break; dp[i] = add(dp[i],dp[i + d[i]*j]); } } if (d[i] <= BS && d[i] > 0 && x[i] > 0) { dp[i] = add(dp[i],sum[i + d[i]][d[i]]); if (i + (x[i] + 1) * d[i] <= n) dp[i] = sub(dp[i],sum[i + (x[i] + 1)*d[i]][d[i]]); } for (int j = 1; j <= BS; ++j) sum[i][j] = add(sum[i + j][j],dp[i]); } cout << dp[1] << endl; }; int t = 1; // cin>>t; while (t--) solver(); }

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

Main.cpp:1:1: error: 'll' does not name a type
    1 | ll add(ll x, ll y) { return (x + y % MOD) % MOD; }
      | ^~
Main.cpp:2:1: error: 'll' does not name a type
    2 | ll sub(ll x, ll y) { return (x - y % MOD + MOD) % MOD; }
      | ^~
Main.cpp:3:1: error: 'll' does not name a type
    3 | ll mul(ll x, ll y) { return (x * y) % MOD; }
      | ^~
Main.cpp:4:6: error: variable or field 'upd' declared void
    4 | void upd(ll& x, ll y) { x = add(x, y); }
      |      ^~~
Main.cpp:4:10: error: 'll' was not declared in this scope
    4 | void upd(ll& x, ll y) { x = add(x, y); }
      |          ^~
Main.cpp:4:14: error: 'x' was not declared in this scope
    4 | void upd(ll& x, ll y) { x = add(x, y); }
      |              ^
Main.cpp:4:17: error: 'll' was not declared in this scope
    4 | void upd(ll& x, ll y) { x = add(x, y); }
      |                 ^~
Main.cpp:5:1: error: 'll' does not name a type
    5 | ll dp[N], d[N], x[N];
      | ^~
Main.cpp:7:1: error: 'll' does not name a type
    7 | ll sum[N][BS];
      | ^~
Main.cpp: In function 'int main()':
Main.cpp:10:5: error: 'cin' was not declared in this scope
   10 |     cin.tie(0)->sync_with_stdio(0);
      |     ^~~
Main.cpp: In lambda function:
Main.cpp:12:16: error: 'n' was not declared in this scope
   12 |         cin >> n;
      |                ^
Main.cpp:14:20: error: 'd' was not declared in this scope
   14 |             cin >> d[i] >> x[i];
      |                    ^
Main.cpp:14:28: error: 'x' was not declared in this scope
   14 |             cin >> d[i] >> x[i];
      |                            ^
Main.cpp:16:13: error: 'dp' was not declared in this scope
   16 |             dp[i] = 1;
      |             ^~
Main.cpp:17:17: error: 'd' was not declared in this scope
   17 |             if (d[i] > BS) {
      |                 ^
Main.cpp:18:38: error: 'x' was not declared in this scope
   18 |                 for (int j = 1; j <= x[i]; ++j) {
      |                                      ^
Main.cpp:20:29: error: 'add' was not declared in this scope
   20 |                     dp[i] = add(dp[i],dp[i + d[i]*j]);
      |                             ^~~
Main.cpp:23:17: error: 'd' was not declared in this scope
   23 |             if (d[i] <= BS && d[i] > 0 && x[i] > 0) {
      |                 ^
Main.cpp:23:43: error: 'x' was not declared in this scope
   23 |             if (d[i] <= BS && d[i] > 0 && x[i] > 0) {
      |                                           ^
Main.cpp:24:35: error: 'sum' was not declared in this scope
   24 |                 dp[i] = add(dp[i],sum[i + d[i]][d[i]]);
      |                                   ^~~
Main.cpp:24:25: error: 'add' was not declared in this scope
   24 |                 dp[i] = add(dp[i],sum[i + d[i]][d[i]]);
      |                         ^~~
Main.cpp:26:29: error: 'sub' was not declared in this scope
   26 |                     dp[i] = sub(dp[i],sum[i + (x[i] + 1)*d[i]][d[i]]);
      |                             ^~~
Main.cpp:29:17: error: 'sum' was not declared in this scope
   29 |                 sum[i][j] = add(sum[i + j][j],dp[i]);
      |                 ^~~
Main.cpp:29:29: error: 'add' was not declared in this scope
   29 |                 sum[i][j] = add(sum[i + j][j],dp[i]);
      |                             ^~~
Main.cpp:31:9: error: 'cout' was not declared in this scope
   31 |         cout << dp[1] << endl;
      |         ^~~~
Main.cpp:31:17: error: 'dp' was not declared in this scope
   31 |         cout << dp[1] << endl;
      |                 ^~
Main.cpp:31:26: error: 'endl' was not declared in this scope
   31 |         cout << dp[1] << endl;
      |                          ^~~~