Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #2315520

Source Code Expand

Copy
```#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;
typedef tuple<int, int, int> tp;

int dp[100][100][100] = {0};

int main() {
int A, B, C;
cin >> A >> B >> C;
queue<tp> q;
q.emplace(A, B, C);
const int inf = 1 << 30;
REP(i, 0, 100) {
REP(j, 0, 100) {
REP(k, 0, 100) {
dp[i][j][k] = inf;
}
}
}
dp[A][B][C] = 0;
while (q.size()) {
int a, b, c;
tie(a, b, c) = q.front();
q.pop();
if (a >= 90 || b >= 90 || c >= 90) continue;
int cost = dp[a][b][c];
int da[] = {2, 0, 0, 1, 1, 0};
int db[] = {0, 2, 0, 1, 0, 1};
int dc[] = {0, 0, 2, 0, 1, 1};
REP(k, 0, 6) {
if (cost + 1 < dp[a + da[k]][b + db[k]][c + dc[k]]) {
dp[a + da[k]][b + db[k]][c + dc[k]] = cost + 1;
q.emplace(a + da[k], b + db[k], c + dc[k]);
}
}
}
int ans = inf;
REP(i, 0, 100) {
ans = min(ans, dp[i][i][i]);
}
cout << ans << endl;
return 0;
}```

#### Submission Info

Submission Time 2018-04-07 21:15:09+0900 C - Same Integers commy C++14 (GCC 5.4.1) 300 1364 Byte AC 15 ms 4224 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 300 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 4 ms 4224 KB
02.txt 7 ms 4224 KB
03.txt 6 ms 4224 KB
04.txt 5 ms 4224 KB
05.txt 4 ms 4224 KB
06.txt 8 ms 4224 KB
07.txt 5 ms 4224 KB
08.txt 5 ms 4224 KB
09.txt 14 ms 4224 KB
10.txt 15 ms 4224 KB
11.txt 7 ms 4224 KB
12.txt 9 ms 4224 KB
13.txt 6 ms 4224 KB
s1.txt 13 ms 4224 KB
s2.txt 13 ms 4224 KB
s3.txt 7 ms 4224 KB