結果

問題 No.1679 マスゲーム
ユーザー keijakkeijak
提出日時 2021-09-13 02:10:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 2,819 ms
コンパイル使用メモリ 207,748 KB
実行使用メモリ 14,440 KB
最終ジャッジ日時 2023-09-07 05:13:56
合計ジャッジ時間 9,096 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 199 ms
14,260 KB
testcase_04 AC 197 ms
14,212 KB
testcase_05 AC 203 ms
14,236 KB
testcase_06 AC 200 ms
14,440 KB
testcase_07 AC 200 ms
14,288 KB
testcase_08 AC 205 ms
14,284 KB
testcase_09 AC 204 ms
14,260 KB
testcase_10 AC 201 ms
14,336 KB
testcase_11 AC 202 ms
14,284 KB
testcase_12 AC 14 ms
4,632 KB
testcase_13 AC 69 ms
8,624 KB
testcase_14 AC 201 ms
14,420 KB
testcase_15 AC 169 ms
12,988 KB
testcase_16 AC 138 ms
11,924 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 48 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP_(i, a_, b_, a, b, ...) \
  for (int i = (a), END_##i = (b); i < END_##i; ++i)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
using i64 = long long;

void print() { std::cout << "\n"; }
template<class T>
void print(const T &x) {
  std::cout << x << "\n";
}
template<typename Head, typename... Tail>
void print(const Head &head, Tail... tail) {
  std::cout << head << " ";
  print(tail...);
}

struct Input {
  template<typename T>
  operator T() const {
    T x;
    std::cin >> x;
    return x;
  }
} in;

#ifdef MY_DEBUG
#include "debug_dump.hpp"
#else
#define DUMP(...)
#endif

using namespace std;

auto solve() {
  const int n = in;
  map<int, int> m0, m1;
  REP(i, n) {
    const int a = in, b = in, t = in;
    if (a == 0) {
      ++m0[b - t];
    } else {
      ++m1[b - t];
    }
  }
  i64 ans = 0;
  for (auto[k, c]: m0) {
    ans += i64(c) * m1[k];
  }
  return ans;
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  print(solve());
}
0