結果

問題 No.988 N×Mマス計算(総和)
ユーザー kinsei0916kinsei0916
提出日時 2020-02-15 00:44:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 2,206 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 201,904 KB
実行使用メモリ 4,552 KB
最終ジャッジ日時 2023-09-20 12:03:08
合計ジャッジ時間 3,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 12 ms
4,376 KB
testcase_12 AC 20 ms
4,428 KB
testcase_13 AC 10 ms
4,376 KB
testcase_14 AC 10 ms
4,380 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 17 ms
4,376 KB
testcase_17 AC 21 ms
4,384 KB
testcase_18 AC 12 ms
4,376 KB
testcase_19 AC 19 ms
4,380 KB
testcase_20 AC 28 ms
4,552 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, N) ans += A[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 ma

ソースコード

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, N) ans += A[i];
    ans %= K;
    ans *= M;
    ans %= K;

    ll t = 0;
    rep(i, M) t += B[i];
    t %= K;
    t *= N;
    t %= K;
    ans = (ans + t) % K;
  } else {
    rep(i, N) ans += A[i];
    ans %= K;

    ll t = 0;
    rep(i, M) t += B[i];
    t %= K;

    ans = (ans * t) % K;
  }

  out(ans);
}
0