제출 #588646

#제출 시각아이디문제언어결과실행 시간메모리
588646peuchUplifting Excursion (BOI22_vault)C++17
5 / 100
2205 ms3000 KiB
#include<bits/stdc++.h> using namespace std; const long long MAXN = 410; const long long INF = 1e18; const long long HALF = MAXN * MAXN / 2; long long m; long long l; long long v[MAXN]; long long dp[2][MAXN * MAXN]; int main(){ scanf("%lld %lld", &m, &l); long long sum = 0; long long cnt = 0; for(long long i = -m; i <= m; i++){ scanf("%lld", &v[i + m]); sum += v[i + m] * i; cnt += v[i + m]; } if(l + HALF >= MAXN * MAXN || l + HALF < 0){ printf("impossible\n"); return 0; } for(long long j = 0; j < MAXN * MAXN; j++) dp[1][j] = INF; dp[1][HALF] = 0; for(long long i = 0; i <= 2 * m; i++){ for(long long k = 0; k < v[i]; k++){ for(long long j = 0; j < MAXN * MAXN; j++) dp[0][j] = dp[1][j]; for(long long j = 0; j < MAXN * MAXN; j++){ dp[1][j] = dp[0][j]; if(j - (i - m - 1) < MAXN * MAXN && j - (i - m) >= 0) dp[1][j] = min(dp[1][j], dp[0][j - (i - m)] + 1); } } } if(dp[1][sum - l + HALF] == INF) printf("impossible\n"); else printf("%lld\n", cnt - dp[1][sum - l + HALF]); }

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

vault.cpp: In function 'int main()':
vault.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%lld %lld", &m, &l);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
vault.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%lld", &v[i + m]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...