제출 #971872

#제출 시각아이디문제언어결과실행 시간메모리
971872mannshah1211Financial Report (JOI21_financial)C++17
28 / 100
4033 ms1048576 KiB
/** * author: hashman * created: **/ #include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) using Int = long long; int main() { int n, d; scanf("%d%d", &n, &d); vector<int> a(n + 1); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); } vector<vector<bool>> pos(n + 1, vector<bool>(n + 1)); vector<int> dp(n + 1); for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { pos[i][j] = (a[i] < a[j]); int prv = i; for (int k = i; k <= j; k++) { if (a[k] < a[j]) { if (k - prv > d) { pos[i][j] = false; } prv = k; } } if (j - prv > d) { pos[i][j] = false; } } } for (int i = 1; i <= n; i++) { dp[i] = 1; for (int j = i - 1; j >= 1; j--) { if (pos[j][i]) { dp[i] = max(dp[i], dp[j] + 1); } } } cout << *max_element(dp.begin() + 1, dp.end()) << '\n'; }

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

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