結果
| 問題 |
No.987 N×Mマス計算(基本)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-25 22:30:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,733 bytes |
| コンパイル時間 | 2,716 ms |
| コンパイル使用メモリ | 201,364 KB |
| 最終ジャッジ日時 | 2025-01-24 18:22:06 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 WA * 5 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#define endl "\n"
#define rep(i,s,l) for(int i=s;i<l;i++)
#define rev_rep(i,l,s) for(int i=l;i>=s;i--)
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using VP = vector<P>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
const int INF = 2147483647;
const ll LINF = 1152921504606846976;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-9;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll p, ll q) { while (q) { ll t = p % q; p = q; q = t; } return p; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll fast_mod(ll x, ll y) { if (x >= y) { return x % y; } else if (x < 0) { return (x % y + y) % y; } else { return x; } }
signed main()
{
const streamsize PRECISION_SIZE = 15;
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
std::cout << std::fixed << std::setprecision(PRECISION_SIZE);
int N, M;
cin >> N >> M;
VS C(M+1),R(N);
vector<VI> T(N, VI(M));
rep(i, 0, M+1) cin >> C[i];
rep(i, 0, N) cin >> R[i];
bool isAdd = (C[0] == "+");
rep(ci, 1, M+1) {
int col_v = stoi(C[ci]);
rep(ri, 0, N) {
int row_v = stoi(R[ri]);
T[ri][ci - 1] = (isAdd ? row_v + col_v : row_v * col_v);
}
}
rep(i, 0, N) {
rep(j, 0, M) {
cout << T[i][j] << " ";
}
cout << endl;
}
return EXIT_SUCCESS;
}