제출 #406050

#제출 시각아이디문제언어결과실행 시간메모리
406050maomao90The short shank; Redemption (BOI21_prison)C++17
15 / 100
2093 ms53428 KiB
#include <bits/stdc++.h> using namespace std; #define mnto(x, y) x = min(x, (__typeof__(x)) y) #define mxto(x, y) x = max(x, (__typeof__(x)) y) #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb emplace_back typedef vector<int> vi; typedef vector<ii> vii; #define INF 1000000005 #define LINF 1000000000000000005 #define MOD 1000000007 #define MAXN 4005 int n, d, t; int ti[MAXN]; int cost[MAXN][MAXN]; ll dp[MAXN][MAXN]; int main() { scanf("%d%d%d", &n, &d, &t); REP (i, 1, n + 1) { scanf("%d", &ti[i]); } REP (i, 1, n + 1) { ll r = -1; int cur = 0; REP (j, i, n + 1) { if (t >= ti[j]) mxto(r, t - ti[j] + j); if (r >= j) cur++; cost[i][j] = cur; } } REP (i, 1, n + 1) { dp[i][0] = cost[1][i]; REP (j, 1, d + 1) { dp[i][j] = LINF; REP (k, 1, i) { mnto(dp[i][j], dp[k][j - 1] + cost[k + 1][i]); } } } printf("%lld\n", dp[n][d]); return 0; }

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

prison.cpp: In function 'int main()':
prison.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  scanf("%d%d%d", &n, &d, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
prison.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |   scanf("%d", &ti[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...