結果

問題 No.1679 マスゲーム
ユーザー You_sakuYou_saku
提出日時 2021-09-11 20:52:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 969 ms
コンパイル使用メモリ 91,436 KB
実行使用メモリ 7,740 KB
最終ジャッジ日時 2023-09-05 09:52:38
合計ジャッジ時間 5,401 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 214 ms
7,452 KB
testcase_04 AC 211 ms
7,504 KB
testcase_05 AC 213 ms
7,740 KB
testcase_06 AC 212 ms
7,636 KB
testcase_07 AC 214 ms
7,724 KB
testcase_08 AC 219 ms
7,556 KB
testcase_09 AC 212 ms
7,504 KB
testcase_10 AC 211 ms
7,520 KB
testcase_11 AC 211 ms
7,564 KB
testcase_12 AC 18 ms
4,376 KB
testcase_13 AC 82 ms
5,408 KB
testcase_14 AC 209 ms
7,636 KB
testcase_15 AC 178 ms
7,052 KB
testcase_16 AC 152 ms
6,552 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include <ios>
#include <iomanip> 
#include<algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    map<int,int>red;
    vector<int>blue;
    for(int i = 0; i < n; i++){
        int a,b,t;
        cin >> a >> b >> t;
        if(a==0){
            if (red.count(b - t))red[b - t]++;
            else red[b - t] = 1;
        }else{
            blue.push_back(b-t);
        }
    }

    for(auto x: blue){
        if(red.count(x)){
            ans += red[x];
        }
    }
    cout << ans << endl;
    return 0;
}
0