제출 #99924

#제출 시각아이디문제언어결과실행 시간메모리
99924MohamedAhmed0동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int dp[105][105][7] ; int arr[105] ; int n , k ; int solve(int idx , int idx2 , int cnt) { if(cnt > k) return 1e9 ; if(idx == n) { if(cnt != k) return 1e9 ; return arr[idx2] ; } int &ret = dp[idx][idx2][cnt] ; if(ret != -1) return ret ; if(idx == 0) { ret = solve(idx+1 , 0 , 1) ; return ret ; } ret = solve(idx+1 , idx , cnt+1) + arr[idx2] ; if(arr[idx] > arr[idx2]) idx2 = idx ; ret = min(ret , solve(idx+1 , idx2 , cnt)); return ret ; } int main() { memset(dp , -1 , sizeof(dp)); scanf("%d %d" , &n , &k) ; for(int i = 0 ; i < n ; ++i) cin>>arr[i] ; return cout<<solve(0 , 0 , 0)<<"\n" , 0 ; }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'int main()':
cave.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d" , &n , &k) ;
     ~~~~~^~~~~~~~~~~~~~~~~~~
/tmp/cce3WUAK.o: In function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccog6NSt.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccog6NSt.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status