제출 #971878

#제출 시각아이디문제언어결과실행 시간메모리
971878mannshah1211Financial Report (JOI21_financial)C++17
48 / 100
4051 ms5796 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<int> dp(n + 1); for (int i = 1; i <= n; i++) { dp[i] = 1; int prv = i; bool ok = true; for (int j = i - 1; j >= 1; j--) { if (a[j] < a[i]) { if (prv - j > d) { ok = false; } if (ok) { dp[i] = max(dp[i], dp[j] + 1); } prv = j; } } } 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...