結果

問題 No.989 N×Mマス計算(K以上)
ユーザー kinsei0916kinsei0916
提出日時 2020-02-15 02:13:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 2,148 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 207,012 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 13:37:35
合計ジャッジ時間 3,345 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,820 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,820 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,816 KB
testcase_05 AC 2 ms
6,820 KB
testcase_06 AC 2 ms
6,816 KB
testcase_07 AC 2 ms
6,820 KB
testcase_08 AC 2 ms
6,816 KB
testcase_09 AC 2 ms
6,816 KB
testcase_10 AC 18 ms
6,820 KB
testcase_11 AC 18 ms
6,820 KB
testcase_12 AC 18 ms
6,816 KB
testcase_13 AC 12 ms
6,816 KB
testcase_14 AC 24 ms
6,816 KB
testcase_15 AC 8 ms
6,820 KB
testcase_16 AC 12 ms
6,816 KB
testcase_17 AC 11 ms
6,820 KB
testcase_18 AC 10 ms
6,816 KB
testcase_19 AC 18 ms
6,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)':
main.cpp:36:7: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |       ^
main.cpp:6:48: note: in definition of macro '_rep3'
    6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
      |                                                ^
main.cpp:10:43: note: in expansion of macro '_rep2'
   10 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
main.cpp:36:3: note: in expansion of macro 'rep'
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |   ^~~
main.cpp:36:7: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |       ^
main.cpp:6:61: note: in definition of macro '_rep3'
    6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
      |                                                             ^
main.cpp:10:43: note: in expansion of macro '_rep2'
   10 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
main.cpp:36:3: note: in expansion of macro 'rep'
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |   ^~~
main.cpp: In function 'int main()':
main.cpp:83:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   83 |     rep(i, M) B[i] = K - B[i];
      |         ^
main.cpp:6:48: note: in definition of macro '_rep3'
    6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
      |                                                ^
main.cpp:10:43: note: in expansion of macro '_rep2'
   10 | #define _overload3(_1, _2, _3, name

ソースコード

diff #

#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int N, M;
  ll K;
  cin >> N >> M >> K;
  char op;
  vl A(N), B(M);
  cin >> op >> B >> A;

  ll ans = 0;

  if (op == '+') {
    rep(i, M) B[i] = K - B[i];
    sort(all(B));
    rep(i, N) ans += upper_bound(all(B), A[i]) - B.begin();
  } else {
    rep(i, M) B[i] = (K + B[i] - 1) / B[i];
    sort(all(B));
    rep(i, N) ans += upper_bound(all(B), A[i]) - B.begin();
  }

  out(ans);
}
0