제출 #564548

#제출 시각아이디문제언어결과실행 시간메모리
564548nikatamlianiFinancial Report (JOI21_financial)C++14
48 / 100
4083 ms1828 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3e5+10; int n, d; int a[N], on[N], rgh[N], dp[N], t[4 * N]; int main() { cin >> n >> d; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= n; ++i) { int count = 0, pos = rgh[i] = i; for (int j = i + 1; j <= n; ++j) { if (j - pos > d) break; if (a[j] <= a[i]) pos = j; rgh[i] = j; } } int best = 0; a[0] = -1; rgh[0] = n; for (int i = 1; i <= n; ++i) { for (int j = 0; j < i; ++j) { if (rgh[j] >= i && a[j] < a[i]) { dp[i] = max(dp[i], dp[j] + 1); } } best = max(best, dp[i]); } cout << best << endl; }

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

Main.cpp: In function 'int main()':
Main.cpp:12:13: warning: unused variable 'count' [-Wunused-variable]
   12 |         int count = 0, pos = rgh[i] = 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...