結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
wakapaijazz
|
| 提出日時 | 2020-02-16 02:22:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,083 bytes |
| コンパイル時間 | 2,204 ms |
| コンパイル使用メモリ | 196,016 KB |
| 最終ジャッジ日時 | 2025-01-09 00:51:23 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 TLE * 10 |
コンパイルメッセージ
In file included from /usr/include/c++/13/istream:41,
from /usr/include/c++/13/sstream:40,
from /usr/include/c++/13/complex:45,
from /usr/include/c++/13/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
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:
/usr/include/c++/13/ostream:204:25: warning: ‘sum’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘void Main()’:
main.cpp:27:8: note: ‘sum’ was declared here
27 | ll sum;
| ^~~
ソースコード
#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;
}
wakapaijazz