結果
| 問題 | 
                            No.1679 マスゲーム
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-09-11 20:52:02 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 629 bytes | 
| コンパイル時間 | 1,052 ms | 
| コンパイル使用メモリ | 92,132 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2024-06-23 05:42:59 | 
| 合計ジャッジ時間 | 5,498 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 WA * 1 | 
ソースコード
#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;
}