結果

問題 No.1679 マスゲーム
ユーザー Nzt3
提出日時 2022-10-05 02:39:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 197,584 KB
最終ジャッジ日時 2025-02-07 21:53:22
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<array<int,2>>Y;
  vector<int>T(600005);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a==0){
      int b,c;
      cin>>b>>c;
      ++T[c-b+2e5];
    }else{
      int b,c;
      cin>>b>>c;
      Y.push_back({b,c});
    }
  }
  long long ans=0;
  for(auto i:Y){
    ans+=T[i[1]-i[0]+2e5];
  }
  cout<<ans<<'\n';
}
0