結果

問題 No.1679 マスゲーム
ユーザー aspiaspi
提出日時 2021-09-10 22:08:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 932 ms
コンパイル使用メモリ 88,744 KB
実行使用メモリ 7,788 KB
最終ジャッジ日時 2023-09-05 05:31:44
合計ジャッジ時間 5,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 234 ms
7,620 KB
testcase_04 AC 228 ms
7,572 KB
testcase_05 AC 231 ms
7,428 KB
testcase_06 AC 235 ms
7,448 KB
testcase_07 AC 237 ms
7,428 KB
testcase_08 AC 229 ms
7,604 KB
testcase_09 AC 227 ms
7,632 KB
testcase_10 AC 239 ms
7,592 KB
testcase_11 AC 234 ms
7,788 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 86 ms
5,252 KB
testcase_14 AC 235 ms
7,420 KB
testcase_15 AC 200 ms
6,992 KB
testcase_16 AC 168 ms
6,536 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 147 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
using namespace std;

int main() {
    long long N, A, B, T, ans = 0;
    map<int, int>ma;
    vector<int>Xpoints;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A >> B >> T;
        if (A == 0) {
            if (ma.count(B - T))ma[B - T]++;
            else ma[B - T] = 1;
        }
        else Xpoints.push_back(B - T);
    }
    for (int t : Xpoints) {
        if (ma.count(t))ans += ma[t];
    }
    cout << ans << endl;
}
0