제출 #67292

#제출 시각아이디문제언어결과실행 시간메모리
67292theknife2001휴가 (IOI14_holiday)C++17
컴파일 에러
0 ms0 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; const int N=3055; long long dp[N][N*3]; bool vis[N]; int a[N]; int n; long long bt(int i , int d) { if(d==0) return 0; // if(dp[i][d]!=-1) // return dp[i][d]; if(d==1) { if(!vis[i]) dp[i][d]=a[i]; else dp[i][d]=0; return dp[i][d]; } long long ret=0; if(i+1<n) ret=max(bt(i+1,d-1),ret); if(i) ret=max(bt(i-1,d-1),ret); if(i+1<n&&!vis[i]) { vis[i]=1; ret=max(bt(i+1,d-2)+a[i],ret); vis[i]=0; } if(i&&!vis[i]) { vis[i]=1; ret=max(bt(i-1,d-2)+a[i],ret); vis[i]=0; } dp[i][d]=ret; return ret; } long long int findMaxAttraction(int m, int start, int d, int ar[]) { memset(dp,-1,sizeof dp); n=m; for(int i=0;i<n;i++) a[i]=ar[i]; return bt(start,d); } int main() { int n, start, d; int attraction[100000]; int i, n_s; n_s = scanf("%d %d %d", &n, &start, &d); for (i = 0 ; i < n; ++i) { n_s = scanf("%d", &attraction[i]); } printf("%lld\n", findMaxAttraction(n, start, d, attraction)); return 0; }

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

holiday.cpp: In function 'int main()':
holiday.cpp:59:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
/tmp/cc6hShD1.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccPixPWR.o:holiday.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status