# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70761 | 2018-08-23T10:17:48 Z | 검수컵(#1978, imsifile) | 놀이터에 떨어진 이상한 약 (FXCUP3_gorgeous) | C++ | 38 ms | 24364 KB |
#include<stdio.h> typedef long long lld; int N, ba[303030]; lld dmg[303030], dy[1111][1111]; lld mx(lld a, lld b){ return a<b?b:a; } int main(){ scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%d", &ba[i]); for(int i=1; i<=N; i++) scanf("%lld", &dmg[i]); for(int k=N-1; k>0; k--){ for(int i=1; i<=N-k; i++){ int j=i+k; dy[i+1][j] = mx(dy[i+1][j], dy[i][j]+(ba[i]==k+1 ? dmg[i]:0)); dy[i][j-1] = mx(dy[i][j-1], dy[i][j]+(ba[j]==k+1 ? dmg[j]:0)); } } for(int i=1; i<=N; i++){ if(ba[i]==1) dy[i][i]+=dmg[i]; printf("%lld ", dy[i][i]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 412 KB | Output is correct |
4 | Correct | 3 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 624 KB | Output is correct |
6 | Correct | 3 ms | 624 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 412 KB | Output is correct |
4 | Correct | 3 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 624 KB | Output is correct |
6 | Correct | 3 ms | 624 KB | Output is correct |
7 | Correct | 3 ms | 656 KB | Output is correct |
8 | Correct | 3 ms | 912 KB | Output is correct |
9 | Correct | 5 ms | 1012 KB | Output is correct |
10 | Correct | 5 ms | 2580 KB | Output is correct |
11 | Correct | 10 ms | 5948 KB | Output is correct |
12 | Correct | 12 ms | 7288 KB | Output is correct |
13 | Correct | 17 ms | 7948 KB | Output is correct |
14 | Correct | 12 ms | 7948 KB | Output is correct |
15 | Correct | 13 ms | 7968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 412 KB | Output is correct |
4 | Correct | 3 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 624 KB | Output is correct |
6 | Correct | 3 ms | 624 KB | Output is correct |
7 | Correct | 3 ms | 656 KB | Output is correct |
8 | Correct | 3 ms | 912 KB | Output is correct |
9 | Correct | 5 ms | 1012 KB | Output is correct |
10 | Correct | 5 ms | 2580 KB | Output is correct |
11 | Correct | 10 ms | 5948 KB | Output is correct |
12 | Correct | 12 ms | 7288 KB | Output is correct |
13 | Correct | 17 ms | 7948 KB | Output is correct |
14 | Correct | 12 ms | 7948 KB | Output is correct |
15 | Correct | 13 ms | 7968 KB | Output is correct |
16 | Runtime error | 38 ms | 24364 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Halted | 0 ms | 0 KB | - |