제출 #482588

#제출 시각아이디문제언어결과실행 시간메모리
482588HazemGlobal Warming (CEOI18_glo)C++14
15 / 100
2083 ms1092 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; const int N = 2e5+1; const LL MOD = 1e9+7; int a[N],dp[N]; int n,k; int calc(){ set<int>st; for(int i=1;i<=n;i++){ if(st.find(a[i])!=st.end())continue; st.insert(a[i]); auto it = st.find(a[i]); it++; if(it==st.end())continue; st.erase(*it); } return st.size(); } void op(int l,int r,int x){ for(int i=l;i<=r;i++) a[i] += x; } int main(){ scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int ans = calc(); for(int i=1;i<=n;i++){ for(int j=-k;j<=k;j++){ op(1,i,j); ans = max(ans,calc()); op(1,i,-j); op(i,n,j); ans = max(ans,calc()); op(i,n,-j); } } printf("%d\n",ans); }

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

glo.cpp: In function 'int main()':
glo.cpp:36:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     scanf("%d%d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~
glo.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         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...
#Verdict Execution timeMemoryGrader output
Fetching results...