Submission #888125

#TimeUsernameProblemLanguageResultExecution timeMemory
888125sleepntsheepFinancial Report (JOI21_financial)C++17
0 / 100
34 ms7124 KiB
#include <iostream> #include <stack> #include <fstream> #include <iomanip> #include <cmath> #include <cassert> #include <cstring> #include <vector> #include <algorithm> #include <deque> #include <set> #include <utility> #include <array> #include <complex> using i64 = long long; using u64 = unsigned long long; using f64 = double; using f80 = long double; using namespace std; using pt = complex<f80>; #define ALL(x) begin(x), end(x) #define ShinLena cin.tie(nullptr)->sync_with_stdio(false); #define N 7003 int dp[N], lt[N]; int main() { ShinLena; int n, d; cin >> n >> d; vector<int> a(n), c; for (auto &x : a) cin >> x; c = a; sort(ALL(c)); for (auto &x : a) x = lower_bound(ALL(c), x) - c.begin(); memset(lt, 0xbf, sizeof lt); for (int i = 0; i < n; ++i) { dp[i] = 1; for (int j = 0; j < c.size(); ++j) if (i - lt[j] <= d) dp[i] = max(dp[lt[j]] + (j < a[i]), dp[i]); for (int j = a[i]; j < c.size(); ++j) lt[i] = i; } cout << dp[n-1]; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:44:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for (int j = 0; j < c.size(); ++j)
      |                         ~~^~~~~~~~~~
Main.cpp:47:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         for (int j = a[i]; j < c.size(); ++j) lt[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...