結果

問題 No.1679 マスゲーム
ユーザー monnumonnu
提出日時 2021-09-16 21:58:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 4,538 ms
コンパイル使用メモリ 234,088 KB
実行使用メモリ 14,400 KB
最終ジャッジ日時 2023-09-12 04:14:51
合計ジャッジ時間 9,978 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 251 ms
14,308 KB
testcase_04 AC 261 ms
14,284 KB
testcase_05 AC 275 ms
14,400 KB
testcase_06 AC 268 ms
14,348 KB
testcase_07 AC 251 ms
14,284 KB
testcase_08 AC 265 ms
14,272 KB
testcase_09 AC 259 ms
14,344 KB
testcase_10 AC 267 ms
14,280 KB
testcase_11 AC 267 ms
14,276 KB
testcase_12 AC 21 ms
4,676 KB
testcase_13 AC 95 ms
8,520 KB
testcase_14 AC 255 ms
14,276 KB
testcase_15 AC 216 ms
13,144 KB
testcase_16 AC 178 ms
11,924 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 144 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,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 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,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 2000005
//#define MOD 1000000007
#define MOD 998244353
#define INF 1000000000
//#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  map<int,int> m1,m2;
  for(int i=0;i<N;i++){
    int A,B,T;
    cin>>A>>B>>T;
    if(A==0){
      m1[B-T]++;
    }else{
      m2[B-T]++;
    }
  }
  ll ans=0;
  for(auto p1:m1){
    ans+=(ll)p1.second*(ll)m2[p1.first];
  }
  cout<<ans<<'\n';
}
0