제출 #528542

#제출 시각아이디문제언어결과실행 시간메모리
528542ShinFinancial Report (JOI21_financial)C++14
0 / 100
3 ms332 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define TASK "task" #define all(x) x.begin(), x.end() using namespace std; const int N = 2e5 + 7; const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const long long INFLL = 1e18 + 7; template <class X, class Y> bool minimize(X &a, Y b) { if (a > b) return a = b, true; return false; } template <class X, class Y> bool maximize(X &a, Y b) { if (a < b) return a = b, true; return false; } int n, D; int a[N]; int dp[N]; void solve(void) { cin >> n >> D; for (int i = 1; i <= n; i ++) cin >> a[i]; int res = 1; for (int i = n; i > 0; i --) { dp[i] = 1; for (int j = i + 1, lim = i + D; j <= min(lim, n); j ++) { if (a[i] >= a[j]) { lim = j + D; } else { maximize(dp[i], dp[j] + 1); } } maximize(res, dp[i]); } cout << res; } signed main(void) { cin.tie(0)->sync_with_stdio(0); #ifndef ONLINE_JUDGE freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout); freopen(TASK".log", "w", stderr); #endif int test = 1; // cin >> test; while (test --) { solve(); } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:50:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |     freopen(TASK".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:51:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |     freopen(TASK".out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:52:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     freopen(TASK".log", "w", stderr);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...