提出 #6659702
ソースコード 拡げる
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
const LL inf = 11234567890;
int main()
{
LL N, M;
in >> N >> M;
std::vector<std::vector<LL>>A(N, std::vector<LL>(M)), B(N, std::vector<LL>(M));
rep(i, N) rep(j, M) in >> A[i][j];
rep(i, N) rep(j, M) in >> B[i][j];
LL ans = 0;
rep(i, N)
{
LL t = inf;
rep(j, M) t = std::min(t, (ans + A[i][j] - 1) / A[i][j] * A[i][j] + B[i][j]);
ans = t;
}
out << ans << std::endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | F - 不便な橋 |
| ユーザ | babcs2035 |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 300 |
| コード長 | 542 Byte |
| 結果 | AC |
| 実行時間 | 143 ms |
| メモリ | 4224 KiB |
ジャッジ結果
| セット名 | Sample | Subtask1 | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | s_01.txt |
| Subtask1 | s_01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 02.txt | AC | 140 ms | 4224 KiB |
| 03.txt | AC | 140 ms | 4224 KiB |
| 04.txt | AC | 142 ms | 4224 KiB |
| 05.txt | AC | 143 ms | 4224 KiB |
| 06.txt | AC | 140 ms | 4224 KiB |
| 07.txt | AC | 140 ms | 4224 KiB |
| 08.txt | AC | 140 ms | 4224 KiB |
| 09.txt | AC | 140 ms | 4224 KiB |
| 10.txt | AC | 140 ms | 4224 KiB |
| s_01.txt | AC | 1 ms | 256 KiB |