結果
問題 |
No.1679 マスゲーム
|
ユーザー |
|
提出日時 | 2021-09-11 19:00:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 1,619 ms |
コンパイル使用メモリ | 173,576 KB |
実行使用メモリ | 5,584 KB |
最終ジャッジ日時 | 2024-06-23 03:22:14 |
合計ジャッジ時間 | 4,905 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int n, m = 0, a, b, t, w = -200000, c = 0, d = 0; vector<pair<int, int>> v; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> t; v.push_back({ b - t, a }); } sort(v.begin(), v.end()); for (auto u : v) { if (w != u.first){ m += c * d; w = u.first; c = 0; d = 0; } if (u.second) c++; else d++; } m += c * d; cout << m << endl; }