結果
問題 | No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない |
ユーザー | jutama |
提出日時 | 2021-06-11 22:44:02 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 271 ms / 2,000 ms |
コード長 | 3,831 bytes |
コンパイル時間 | 5,355 ms |
コンパイル使用メモリ | 184,440 KB |
実行使用メモリ | 5,604 KB |
最終ジャッジ日時 | 2023-08-21 13:30:20 |
合計ジャッジ時間 | 15,704 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 97 ms
4,380 KB |
testcase_14 | AC | 244 ms
5,212 KB |
testcase_15 | AC | 128 ms
4,376 KB |
testcase_16 | AC | 124 ms
4,380 KB |
testcase_17 | AC | 92 ms
4,380 KB |
testcase_18 | AC | 176 ms
4,612 KB |
testcase_19 | AC | 162 ms
4,504 KB |
testcase_20 | AC | 200 ms
4,796 KB |
testcase_21 | AC | 8 ms
4,376 KB |
testcase_22 | AC | 175 ms
4,500 KB |
testcase_23 | AC | 145 ms
4,380 KB |
testcase_24 | AC | 29 ms
4,380 KB |
testcase_25 | AC | 255 ms
5,372 KB |
testcase_26 | AC | 268 ms
5,436 KB |
testcase_27 | AC | 127 ms
4,380 KB |
testcase_28 | AC | 268 ms
5,456 KB |
testcase_29 | AC | 268 ms
5,388 KB |
testcase_30 | AC | 267 ms
5,392 KB |
testcase_31 | AC | 267 ms
5,400 KB |
testcase_32 | AC | 268 ms
5,392 KB |
testcase_33 | AC | 268 ms
5,292 KB |
testcase_34 | AC | 269 ms
5,372 KB |
testcase_35 | AC | 270 ms
5,388 KB |
testcase_36 | AC | 271 ms
5,320 KB |
testcase_37 | AC | 269 ms
5,384 KB |
testcase_38 | AC | 267 ms
5,580 KB |
testcase_39 | AC | 267 ms
5,496 KB |
testcase_40 | AC | 267 ms
5,476 KB |
testcase_41 | AC | 267 ms
5,368 KB |
testcase_42 | AC | 267 ms
5,604 KB |
testcase_43 | AC | 250 ms
5,392 KB |
testcase_44 | AC | 250 ms
5,392 KB |
testcase_45 | AC | 250 ms
5,320 KB |
testcase_46 | AC | 249 ms
5,376 KB |
testcase_47 | AC | 252 ms
5,324 KB |
testcase_48 | AC | 270 ms
5,292 KB |
testcase_49 | AC | 268 ms
5,376 KB |
testcase_50 | AC | 2 ms
4,380 KB |
testcase_51 | AC | 1 ms
4,380 KB |
testcase_52 | AC | 1 ms
4,376 KB |
ソースコード
#include <atcoder/all> #include <bitset> #include <fstream> #include <functional> #include <iostream> #include <iomanip> #include <limits> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; using namespace atcoder; typedef long long ll; typedef long double ld; typedef std::pair<int, int> pii; typedef std::pair<ll, ll> pll; typedef std::pair<ld, ld> pid; typedef std::pair<ll, std::string> pls; typedef std::vector<bool> vb; typedef std::vector<vb> vvb; typedef std::vector<int> vi; typedef std::vector<vi> vvi; typedef std::vector<vvi> vvvi; typedef std::vector<vvvi> vvvvi; typedef std::vector<ll> vl; typedef std::vector<vl> vvl; typedef std::vector<vvl> vvvl; typedef std::vector<vvvl> vvvvl; typedef std::vector<ld> vd; typedef std::vector<vd> vvd; typedef std::vector<std::string> vs; #define rep(i,n) for(auto i=0; i<n; ++i) #define repm(i,s,n) for(auto i=s; i<n; ++i) #define repd(i,n) for(auto i=n-1; i>=0; --i) #define repdm(i,e,n) for(auto i=n-1; i>=e; --i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() template <class T> inline bool chmax(T& a, T b, int eq = 0) { if (a < b || (a == b && eq)) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T& a, T b, int eq = 0) { if (a > b || (a == b && eq)) { a = b; return 1; } return 0; } template <class mint, internal::is_modint_t<mint>* = nullptr> constexpr istream& operator>>(istream& is, mint& x) noexcept {long long v = 0; std::cin >> v; x = v; return is;} template <class mint, internal::is_modint_t<mint>* = nullptr> constexpr ostream& operator<<(ostream& os, const mint& x) noexcept {os << x.val(); return os;} inline void _n() { std::cout << std::endl; } template <class T> inline void _(const T a) { std::cout << a; } template <class T> inline void _l(const T a) { _(a); _n(); } template <class T> inline void _s(const T a) { _(a); _(' '); } template <class T> inline void _v(const std::vector<T> v) { for(auto a : v) _(a); } template <class T> inline void _vl(const std::vector<T> v) { for(auto a : v) _l(a); } template <class T> inline void _vs(const std::vector<T> v) { for(auto a : v) _s(a); _n(); } template <class T> inline void _vvl(const std::vector<std::vector<T>> v) { for(auto a : v) { _v(a); _n(); } } template <class T> inline void _vvs(const std::vector<std::vector<T>> v) { for(auto a : v) { _vs(a); } } inline void ynl(const bool b) {_l(b ? "yes" : "no");} inline void yns(const bool b) {_l(b ? "Yes" : "No");} inline void ynu(const bool b) {_l(b ? "YES" : "NO");} constexpr int INF = numeric_limits<int>::max() >> 1; constexpr long long INF_LL = numeric_limits<long long>::max() >> 1LL; const long long MOD1 = 1000000007; const long long MOD9 = 998244353; using mint1 = atcoder::modint1000000007; using mint9 = atcoder::modint998244353; //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// void solve() { int N; cin >> N; vector<mint9> T(N), V(N); rep(i, N) cin >> T[i] >> V[i]; mint9 ans = 0; mint9 tmp1 = 0; rep(i, N) tmp1 += T[i]; mint9 tmp2 = 0; rep(i, N) { ans -= V[i] * tmp2 * (tmp2 + 1) * (tmp2 + 2) * (tmp2 + 3) / 24; ans -= V[i] * tmp1 * tmp2 * (tmp2 + 1) * (tmp2 + 2) / 6; tmp1 -= T[i]; tmp2 += T[i]; ans += V[i] * tmp2 * (tmp2 + 1) * (tmp2 + 2) * (tmp2 + 3) / 24; ans += V[i] * tmp1 * tmp2 * (tmp2 + 1) * (tmp2 + 2) / 6; } _l(ans); } //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); std::cin.tie(0); std::ios::sync_with_stdio(false); solve(); return 0; }