結果

問題 No.988 N×Mマス計算(総和)
コンテスト
ユーザー ilplrr
提出日時 2020-02-14 21:53:41
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 452 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,259 ms
コンパイル使用メモリ 186,416 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-27 18:35:26
合計ジャッジ時間 2,169 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int N, M, K;
  char op;
  cin >> N >> M >> K >> op;
  vector<int> A(N), B(M);
  for (auto &x : B) cin >> x;
  for (auto &x : A) cin >> x;

  int sum = accumulate(A.begin(), A.end(), 0LL, [&](int s, int a){return (s + a) % K;});
  int ans = 0;
  for (auto x : B) {
    int t = (op == '+' ? sum + x * N : sum * x);
    ans = (ans + t) % K;
  }
  cout << ans << endl;
}
0