結果

問題 No.789 範囲の合計
ユーザー greentea011
提出日時 2019-04-02 14:09:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 435 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 17,536 KB
最終ジャッジ日時 2024-11-29 18:52:30
合計ジャッジ時間 28,556 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>

std::map<int, long> mm;

int main() {
    int n;
    long ans=0;
    std::cin >> n;
    int q,x,y;
    for(int i=0;i<n;i++) {
        std::cin >> q >> x >> y;
        if (q==0) mm[x]+=y;
        else {
            for (int j=x;j<=y;j++) {
                if (mm.find(j)!=mm.end()) {
                    ans+=mm[j];
                }
            }
        }
    }
    std::cout << ans << std::endl;
}
0