답안 #333297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333297 2020-12-05T09:54:53 Z AmineTrabelsi Rabbit Carrot (LMIO19_triusis) C++14
14 / 100
1000 ms 78644 KB
#include "bits/stdc++.h"
using namespace std;
// Hi ☻
int n,m; // towerscnt, mxjump
vector<int> heights;
const int M = 5005;
map<int,int> dp[M];
int solve(int index,int prev){
    if(index >= n)return 0;
    auto it = dp[index].find(prev);
    if(it != dp[index].end())return it->second;
    if(heights[index]-prev > m){ // you need to lower this
        return dp[index][prev] = solve(index+1, prev+m)+1;
    }// you can get here
    // change this or don't 
    return dp[index][prev] = min(solve(index+1,heights[index]),solve(index+1,prev+m)+1); // change this to max possible
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    cin>>n>>m;
    heights.assign(n,0);
    for(auto &i:heights)cin>>i;
    cout<<solve(0,0) <<'\n'; // rabbit start at 0 height 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 620 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 620 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 640 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 620 KB Output is correct
13 Correct 1 ms 620 KB Output is correct
14 Correct 1 ms 620 KB Output is correct
15 Correct 1 ms 620 KB Output is correct
16 Correct 1 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Execution timed out 1080 ms 59660 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1268 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 18 ms 7148 KB Output is correct
4 Execution timed out 1086 ms 78644 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1268 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 18 ms 7148 KB Output is correct
4 Execution timed out 1086 ms 78644 KB Time limit exceeded
5 Halted 0 ms 0 KB -