# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893052 | goodspeed0208 | Snake Escaping (JOI18_snake_escaping) | C++14 | 280 ms | 32460 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<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<utility>
#define int long long
#define INF 1000000000000000000
#define pii pair<long long, long long>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, q, pn;
cin >> n >> q;
string s, c;
cin >> s;
vector<int>t(25); t[0] = 1;
for (int i = 1 ; i < 25 ; i++) t[i] = t[i-1] * 3;
pn = t[n];
vector<int>dp(pn+5, -1);
int k = 0;
for (int i = 0 ; i < pn ; i++) {
for (int j = 0 ; j < n ; j++) {
int tmp = i / t[j] % 3;
if (tmp == 2) {
dp[i] = dp[i-t[j]] + dp[i-t[j]*2];
break;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |