結果

問題 No.1679 マスゲーム
ユーザー hiro71687khiro71687k
提出日時 2023-08-27 10:07:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 4,466 ms
コンパイル使用メモリ 261,488 KB
実行使用メモリ 20,520 KB
最終ジャッジ日時 2023-08-27 10:07:12
合計ジャッジ時間 9,610 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,148 KB
testcase_01 AC 6 ms
10,904 KB
testcase_02 AC 5 ms
10,896 KB
testcase_03 AC 195 ms
20,408 KB
testcase_04 AC 169 ms
20,236 KB
testcase_05 AC 173 ms
20,364 KB
testcase_06 AC 167 ms
20,236 KB
testcase_07 AC 168 ms
20,344 KB
testcase_08 AC 168 ms
20,304 KB
testcase_09 AC 173 ms
20,520 KB
testcase_10 AC 174 ms
20,308 KB
testcase_11 AC 167 ms
20,272 KB
testcase_12 AC 20 ms
11,592 KB
testcase_13 AC 71 ms
14,856 KB
testcase_14 AC 166 ms
20,236 KB
testcase_15 AC 144 ms
18,720 KB
testcase_16 AC 125 ms
17,668 KB
testcase_17 AC 6 ms
10,900 KB
testcase_18 AC 159 ms
20,384 KB
testcase_19 AC 6 ms
11,008 KB
testcase_20 AC 6 ms
10,856 KB
testcase_21 AC 6 ms
10,864 KB
testcase_22 AC 5 ms
10,976 KB
testcase_23 AC 6 ms
10,860 KB
testcase_24 AC 5 ms
10,848 KB
testcase_25 AC 6 ms
11,004 KB
testcase_26 AC 6 ms
10,976 KB
testcase_27 AC 7 ms
10,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1009999999999999990;
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n),b(n),t(n);
    vector<ll>aa(500000,0),bb(500000,0);
    vector<pair<ll,pair<ll,ll>>>p(n);
    ll geta=200000;
    ll ans=0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i] >> t[i];
        if (a[i]==0)
        {
            aa[b[i]-t[i]+geta]++;
            ans+=bb[b[i]-t[i]+geta];
        }else{
            bb[b[i]-t[i]+geta]++;
            ans+=aa[b[i]-t[i]+geta];
        }
    }
    cout << ans << endl;
}
0