제출 #934016

#제출 시각아이디문제언어결과실행 시간메모리
934016Amirreza_FakhriGlobal Warming (CEOI18_glo)C++17
27 / 100
40 ms4588 KiB
// In the name of the God #include <bits/stdc++.h> #define ll long long // #define int long long #define pb push_back #define F first #define S second #define mp make_pair #define pii pair <int, int> #define smin(x, y) (x) = min((x), (y)) #define smax(x, y) (x) = max((x), (y)) #define all(x) (x).begin(), (x).end() using namespace std; const int inf = 1e9+7; const int mod = 998244353; const int maxn = 2e5+5; int n, x, a[maxn], b[maxn], c[maxn]; vector <int> vec; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> x; for (int i = 0; i < n; i++) { cin >> a[i]; int j = lower_bound(all(vec), a[i])-vec.begin(); b[i] = j+1; if (j == vec.size()) vec.pb(a[i]); else vec[j] = a[i]; j = lower_bound(all(vec), a[i]+x)-vec.begin(); c[i] = j+1; } vec.clear(); int ans = 0; for (int i = n-1; i >= 0; i--) { int j = lower_bound(all(vec), -a[i])-vec.begin(); if (j == vec.size()) vec.pb(-a[i]); else vec[j] = -a[i]; smax(ans, c[i]+j); } cout << ans << '\n'; return 0; }

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

glo.cpp: In function 'int32_t main()':
glo.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if (j == vec.size()) vec.pb(a[i]);
      |             ~~^~~~~~~~~~~~~
glo.cpp:38:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if (j == vec.size()) vec.pb(-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...
#Verdict Execution timeMemoryGrader output
Fetching results...