제출 #129009

#제출 시각아이디문제언어결과실행 시간메모리
129009arnold518Cloud Computing (CEOI18_clo)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; const int INF = numeric_limits<int>::max(); int N, X, A[MAXN+10]; int lis[MAXN+10], lds[MAXN+10], ans; pii change[MAXN+10]; int main() { int i, j; scanf("%d%d", &N, &X); for(i=1; i<=N; i++) scanf("%d", &A[i]); for(i=1; i<=N; i++) lis[i]=INF; for(i=1; i<=N; i++) { int it=lower_bound(lis+1, lis+N+1, A[i])-lis; change[i]={it, lis[it]}; lis[it]=A[i]; ans=max(ans, it); } for(i=N; i>=1; i--) { int it=lower_bound(lds+1, lds+N+1, A[i]+X, greater<int>())-lds; lds[it]=A[i]+X; lis[change[i].first]=change[i].second; int jt=lower_bound(lis+1, lis+N+1, A[i]+X)-lis-1; ans=max(ans, it+jt); } printf("%d", ans); }

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

clo.cpp: In function 'int main()':
clo.cpp:17:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
clo.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &X);
     ~~~~~^~~~~~~~~~~~~~~~
clo.cpp:20:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) 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...