Contest Duration: - (local time) (300 minutes) Back to Home

Submission #6663997

Source Code Expand

Copy
```#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧＿∧
∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
（ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
／　　　＼　 　  |　|
/　　 /￣￣￣￣/　　|
＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, M, A[505][505], B[505][505];
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N >> M;
rep(i, 0, N) rep(j, 0, M) cin >> A[i][j];
rep(i, 0, N) rep(j, 0, M) cin >> B[i][j];

int t = 0;
rep(i, 0, N) {
int opt = inf;
rep(j, 0, M) {
int t2 = t;
if (0 < t2 % A[i][j]) t2 += (A[i][j] - (t2 % A[i][j]));
chmin(opt, t2 + B[i][j]);
}
t = opt;
}
cout << t << endl;
}

```

#### Submission Info

Submission Time 2019-08-03 18:12:09+0900 F - 不便な橋 hamayanhamayan C++14 (GCC 5.4.1) 300 1764 Byte AC 42 ms 2304 KB

#### Judge Result

Score / Max Score 0 / 0 300 / 300
Status
 AC × 1
 AC × 10
Set Name Test Cases
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
Case Name Status Exec Time Memory
02.txt AC 41 ms 2176 KB
03.txt AC 41 ms 2176 KB
04.txt AC 40 ms 2176 KB
05.txt AC 41 ms 2176 KB
06.txt AC 40 ms 2304 KB
07.txt AC 40 ms 2176 KB
08.txt AC 42 ms 2304 KB
09.txt AC 41 ms 2304 KB
10.txt AC 41 ms 2176 KB
s_01.txt AC 1 ms 256 KB