제출 #627728

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6277282022-08-12 20:37:38Abrar_Al_SamitCollecting Stamps 3 (JOI20_ho_t3)C++17
25 / 100
523 ms127432 KiB
#include<bits/stdc++.h>
using namespace std;
const int MX = 203;
int n, L;
int pos[MX], T[MX];
map<tuple<int,int,long long>, int>dp;
int MAXT;
int dist(int i, int j) {
int ret = abs(pos[i]-pos[j]);
return min(ret, L-ret);
}
int solve(int i, int j, long long CLOCK) {
if(CLOCK>MAXT) return 0;
if(dp.count({i, j, CLOCK})) return dp[{i, j, CLOCK}];
int ret = 0;
if(i<j) {
if(i<n) ret = max(ret, solve(j, i+1, CLOCK+dist(i, j)));
else ret = max(ret, solve(j, j, CLOCK+dist(i, j)));
if(i<n) ret = max(ret, solve(i+1, j, CLOCK+dist(i, i+1)));
} else if(i>j) {
if(i>1) ret = max(ret, solve(i-1, j, CLOCK+dist(i, i-1)));
if(i>1) ret = max(ret, solve(j, i-1, CLOCK+dist(j, i)));
else ret = max(ret, solve(j, j, CLOCK+dist(j, i)));
}
ret += CLOCK<=T[i];
dp[{i, j, CLOCK}] = ret;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...