結果
問題 |
No.1679 マスゲーム
|
ユーザー |
|
提出日時 | 2024-04-22 11:43:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 354 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 4,564 ms |
コンパイル使用メモリ | 255,940 KB |
最終ジャッジ日時 | 2025-02-21 08:33:48 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int main() { ll N; cin >> N; vector<ll> a(N), b(N), t(N); map<ll, ll> mp; for (int i = 0; i < N; i++) { cin >> a[i] >> b[i] >> t[i]; if (a[i] == 0) { mp[b[i] - t[i]]++; } } ll ans = 0; for (int i = 0; i < N; i++) { if (a[i] == 1) { ans += mp[b[i] - t[i]]; } } cout << ans << endl; return 0; }