結果

問題 No.633 バスの運賃
ユーザー a01sa01to
提出日時 2025-03-03 00:12:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 3,411 ms
コンパイル使用メモリ 274,500 KB
実行使用メモリ 8,604 KB
最終ジャッジ日時 2025-03-03 00:12:40
合計ジャッジ時間 3,552 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n - 1), b(n), c(n);
  rep(i, n - 1) cin >> a[i];
  rep(i, n) cin >> b[i] >> c[i];
  ll ans = 0;
  int now = c[0];
  rep(i, n - 1) {
    ans += a[i] * now;
    now += c[i + 1] - b[i + 1];
  }
  cout << ans << '\n';
  return 0;
}
0