結果
問題 |
No.789 範囲の合計
|
ユーザー |
![]() |
提出日時 | 2019-03-19 13:45:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 836 ms |
コンパイル使用メモリ | 84,480 KB |
実行使用メモリ | 294,784 KB |
最終ジャッジ日時 | 2024-09-13 19:58:27 |
合計ジャッジ時間 | 5,489 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | MLE * 1 -- * 14 |
ソースコード
#include <iostream> #include <map> #include <functional> #include <stdio.h> struct hoge { long ans; int a; int b; std::map<int,int> imp; void calc(int q) { static std::map<int,std::function<void ()>> table = { {0, [this](){imp[a]+=b;}}, {1, [this](){for (int i=a;i<=b;i++) ans+=imp[i];}}, }; table[q](); }; }; int main() { int q; int c; struct hoge Hoge; Hoge.ans = 0; scanf("%d",&c); for (int i=0;i<c;i++) { scanf("%d %d %d",&q,&(Hoge.a),&(Hoge.b)); Hoge.calc(q); } printf("%ld\n",Hoge.ans); }