답안 #100260

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100260 2019-03-10T07:08:23 Z Milki Sličice (COCI19_slicice) C++14
컴파일 오류
0 ms 0 KB
ll dp[MAXN][MAXN];

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);

  cin >> n >> m >> k;
  REP(i, n) cin >> p[i];
  REP(i, m + 1) cin >> val[i];
  REP(i, min(k + 1, m - p[0] + 1)) dp[0][i] = val[ min(p[0] + i, m) ];

  FOR(i, 1, n) REP(j, k + 1) REP(last, m - p[i] + 1){
    if(j - last < 0) continue;
    dp[i][j] = max(dp[i][j], dp[i - 1][j - last] + val[ p[i] + last ] );
  }
  cout << dp[n - 1][k];
}

Compilation message

slicice.cpp:2:1: error: 'll' does not name a type
 ll dp[MAXN][MAXN];
 ^~
slicice.cpp: In function 'int main()':
slicice.cpp:5:3: error: 'ios_base' has not been declared
   ios_base::sync_with_stdio(false); cin.tie(0);
   ^~~~~~~~
slicice.cpp:5:37: error: 'cin' was not declared in this scope
   ios_base::sync_with_stdio(false); cin.tie(0);
                                     ^~~
slicice.cpp:5:37: note: suggested alternative: 'main'
   ios_base::sync_with_stdio(false); cin.tie(0);
                                     ^~~
                                     main
slicice.cpp:7:10: error: 'n' was not declared in this scope
   cin >> n >> m >> k;
          ^
slicice.cpp:7:15: error: 'm' was not declared in this scope
   cin >> n >> m >> k;
               ^
slicice.cpp:7:20: error: 'k' was not declared in this scope
   cin >> n >> m >> k;
                    ^
slicice.cpp:8:7: error: 'i' was not declared in this scope
   REP(i, n) cin >> p[i];
       ^
slicice.cpp:8:3: error: 'REP' was not declared in this scope
   REP(i, n) cin >> p[i];
   ^~~
slicice.cpp:10:25: error: 'p' was not declared in this scope
   REP(i, min(k + 1, m - p[0] + 1)) dp[0][i] = val[ min(p[0] + i, m) ];
                         ^
slicice.cpp:10:10: error: 'min' was not declared in this scope
   REP(i, min(k + 1, m - p[0] + 1)) dp[0][i] = val[ min(p[0] + i, m) ];
          ^~~
slicice.cpp:10:10: note: suggested alternative: 'main'
   REP(i, min(k + 1, m - p[0] + 1)) dp[0][i] = val[ min(p[0] + i, m) ];
          ^~~
          main
slicice.cpp:12:3: error: 'FOR' was not declared in this scope
   FOR(i, 1, n) REP(j, k + 1) REP(last, m - p[i] + 1){
   ^~~
slicice.cpp:16:3: error: 'cout' was not declared in this scope
   cout << dp[n - 1][k];
   ^~~~
slicice.cpp:16:11: error: 'dp' was not declared in this scope
   cout << dp[n - 1][k];
           ^~