제출 #533150

#제출 시각아이디문제언어결과실행 시간메모리
5331504fectaFinancial Report (JOI21_financial)C++17
48 / 100
4078 ms6784 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define ld long double #define pii pair<int, int> #define f first #define s second #define boost() cin.tie(0), cin.sync_with_stdio(0) const int MN = 300005; int n, d, a[MN], ans = 1, bit[MN], dp[MN], dead[MN]; vector<int> xs; map<int, int> mp; void upd(int x, int val) { for (int i = x; i < MN; i += i & -i) bit[i] = max(bit[i], val); } int qry(int x) { int ret = 0; for (int i = x; i > 0; i -= i & -i) ret = max(ret, bit[i]); return ret; } int32_t main() { boost(); cin >> n >> d; for (int i = 1; i <= n; i++) cin >> a[i], xs.push_back(a[i]); sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(), xs.end()), xs.end()); for (int i = 0; i < xs.size(); i++) mp[xs[i]] = i + 1; for (int i = 1; i <= n; i++) { dp[i] = 1, dead[i] = i; for (int j = 1; j < i; j++) { if (dead[j] < i - d) continue; if (a[j] < a[i]) dp[i] = max(dp[i], dp[j] + 1); else dead[j] = i; } ans = max(ans, dp[i]); } printf("%lld\n", ans); return 0; }

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

Main.cpp: In function 'int32_t main()':
Main.cpp:35:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < xs.size(); i++) mp[xs[i]] = i + 1;
      |                     ~~^~~~~~~~~~~
#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...