結果
問題 |
No.1679 マスゲーム
|
ユーザー |
![]() |
提出日時 | 2021-09-16 21:58:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 548 bytes |
コンパイル時間 | 3,727 ms |
コンパイル使用メモリ | 236,888 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-06-29 17:15:13 |
合計ジャッジ時間 | 8,352 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#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'; }