結果

問題 No.988 N×Mマス計算(総和)
ユーザー BapliscaBaplisca
提出日時 2020-05-10 13:04:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,746 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 201,484 KB
実行使用メモリ 4,708 KB
最終ジャッジ日時 2023-09-20 12:23:56
合計ジャッジ時間 3,276 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 10 ms
4,380 KB
testcase_11 AC 14 ms
4,376 KB
testcase_12 AC 23 ms
4,424 KB
testcase_13 AC 12 ms
4,376 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 AC 10 ms
4,380 KB
testcase_16 AC 18 ms
4,376 KB
testcase_17 AC 23 ms
4,376 KB
testcase_18 AC 14 ms
4,376 KB
testcase_19 AC 22 ms
4,376 KB
testcase_20 AC 30 ms
4,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
  gearup;
  ll n,m,k; cin >>n>>m>>k;
  char op; cin >> op;
  vl b(m),a(n);
  rep(i,m)cin>>b[i];
  rep(i,n)cin>>a[i];
  ll sum = 0;
  rep(i,n)sum = (sum + a[i])%k;
  ll res = 0;
  rep(i,m){
      if(op == '+')res+=b[i]*n + sum;
      else res+=b[i]*sum;
      res %= k;
  }
  out(res);
}
0