# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363666 | dolphingarlic | Connect (CEOI06_connect) | C++14 | 92 ms | 65540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
struct State {
State *prv;
int cost, type;
State(int _cost = 10000) : prv(nullptr), cost(_cost), type(-1) {}
State(State *_prv, int _type) : prv(_prv), type(_type), cost(_prv->cost) {
if (type < 4) cost++;
else if (type < 10) cost += 2;
}
State(State *_prv1, int _type1, State *_prv2, int _type2) {
if (_prv1->cost < _prv2->cost) prv = _prv1, type = _type1;
else prv = _prv2, type = _type2;
cost = prv->cost;
if (type < 4) cost++;
else if (type < 10) cost += 2;
}
};
string grid[25];
State *dp[12][40][1 << 13];
int main() {
cin.tie(0)->sync_with_stdio(0);
int r, c;
cin >> r >> c;
getline(cin, grid[0]); // Buffer stuff >:(
for (int i = 0; i < r; i++) getline(cin, grid[i]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |