제출 #846965

#제출 시각아이디문제언어결과실행 시간메모리
846965SUNWOOOOOOOOFinancial Report (JOI21_financial)C++17
48 / 100
187 ms191728 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 7005; int n, d, A[mxN], dp[mxN], pass[mxN][mxN]; vector <int> va; int main() { scanf("%d %d", &n, &d); for (int i = 1; i <= n; i++) { scanf("%d", &A[i]); va.push_back(A[i]); } sort(va.begin(), va.end()); va.erase(unique(va.begin(), va.end()), va.end()); for (int i = 1; i <= n; i++) A[i] = lower_bound(va.begin(), va.end(), A[i]) - va.begin() + 1; for (int i = 1; i < n; i++){ for (int j = i + 1, last = i; j <= n; j++){ if (j - last <= d && A[i] < A[j]) pass[i][j] = 1; if (j - last <= d && A[i] >= A[j]) last = j; } } int ans = 0; for (int i = 1; i <= n; i++){ dp[i] = 1; for (int j = 1; j < i; j++){ if (!pass[j][i]) continue; dp[i] = max(dp[i], dp[j] + 1); } ans = max(ans, dp[i]); } printf("%d\n", ans); return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &d);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &A[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...