結果

問題 No.988 N×Mマス計算(総和)
ユーザー wakapaijazzwakapaijazz
提出日時 2020-02-16 02:22:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,083 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 203,104 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-06 07:23:33
合計ジャッジ時間 5,746 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'void Main()' at main.cpp:44:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'void Main()':
main.cpp:27:8: note: 'sum' was declared here
   27 |     ll sum;
      |        ^~~

ソースコード

diff #

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

void Main()
{
    int n, m, k;
    cin >> n >> m >> k;
    char op;
    cin >> op;
    vll b(m), a(n);
    rep(j,m) cin >> b[j];
    rep(i,n) cin >> a[i];
    ll sum;
    if(op == '+'){
        sum = 0;
        rep(i,n){
            rep(j,m){
                sum = (sum + a[i] + b[j]) % k;
            }
        }
    }
    else if(op == '*'){
        sum = 0;
        rep(i,n){
            rep(j,m){
                sum = (sum + (a[i]%k)*(b[j]%k))%k;
            }
        }
    }
    cout << sum << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}
0