제출 #1127277

#제출 시각아이디문제언어결과실행 시간메모리
1127277salmonUplifting Excursion (BOI22_vault)C++20
5 / 100
5092 ms2368 KiB
#include <bits/stdc++.h> using namespace std; int N; int M; long long int lst[210]; long long int L; int main(){ scanf(" %d",&M); scanf(" %lld",&L); int memo[M * 2 * 50 * 50 + 5]; for(int i = 0; i <= M * 50 * 50 * 2; i++){ memo[i] = -1; } memo[M * 50 * 50] = 0; for(int i = 0; i <= M * 2; i++){ scanf(" %lld",&lst[i]); for(int j = 0; j < lst[i]; j++){ int num = i - M; if(num <= 0){ for(int i = -num; i <= M * 50 * 50 * 2; i++){ if(memo[i] != -1) memo[i + num] = max(memo[i + num],memo[i] + 1); } } else{ for(int i = M * 50 * 50 * 2 - num; i >= 0; i--){ if(memo[i] != -1) memo[i + num] = max(memo[i + num],memo[i] + 1); } } } } if(L >= -M * 50 * 50 && L <= M * 50 * 50 && memo[L + M * 50 * 50] != -1)printf("%d\n",memo[L + M * 50 * 50]); else printf("impossible"); } /* 1 100 100 100 100 */

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

vault.cpp: In function 'int main()':
vault.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf(" %d",&M);
      |     ~~~~~^~~~~~~~~~
vault.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %lld",&L);
      |     ~~~~~^~~~~~~~~~~~
vault.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf(" %lld",&lst[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...