結果

問題 No.989 N×Mマス計算(K以上)
ユーザー kinsei0916
提出日時 2020-02-15 02:13:28
言語 C++17(1z)
(gcc 9.2.0)
結果
AC  
実行時間 24 ms
コード長 2,148 Byte
コンパイル時間 1,896 ms
使用メモリ 4,024 KB
最終ジャッジ日時 2020-02-15 02:13:31

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
1_sample1.txt AC 4 ms
3,304 KB
2_sample2.txt AC 0 ms
3,316 KB
3.txt AC 0 ms
3,296 KB
4.txt AC 0 ms
3,260 KB
5.txt AC 4 ms
3,400 KB
6.txt AC 4 ms
3,300 KB
7.txt AC 0 ms
3,300 KB
8.txt AC 4 ms
3,268 KB
9.txt AC 4 ms
3,400 KB
10.txt AC 0 ms
3,308 KB
11.txt AC 16 ms
3,580 KB
12.txt AC 20 ms
3,512 KB
13.txt AC 16 ms
3,744 KB
14.txt AC 12 ms
3,352 KB
15.txt AC 24 ms
4,024 KB
16.txt AC 8 ms
3,256 KB
17.txt AC 12 ms
3,552 KB
18.txt AC 12 ms
3,444 KB
19.txt AC 8 ms
3,496 KB
20.txt AC 20 ms
3,540 KB
テストケース一括ダウンロード
コンパイルメッセージ
main.cpp: 関数 ‘std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)’ 内:
main.cpp:36:7: 警告: 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: 備考: 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: 備考: in expansion of macro ‘_rep2’
   10 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
main.cpp:36:3: 備考: in expansion of macro ‘rep’
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |   ^~~
main.cpp:36:7: 警告: 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: 備考: 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: 備考: in expansion of macro ‘_rep2’
   10 | #define _overload3(_1, _2, _3, name, ...) name
      |                                           ^~~~
main.cpp:36:3: 備考: in expansion of macro ‘rep’
   36 |   rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
      |   ^~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:83:9: 警告: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   83 |     rep(i, M) B[i] = K - B[i];
      |         ^
main.cpp:6:48: 備考: 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: 備考: in expansion o

ソースコード

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