제출 #940002

#제출 시각아이디문제언어결과실행 시간메모리
940002vjudge1Global Warming (CEOI18_glo)C++17
38 / 100
2033 ms9696 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define int long long #define ff first #define ss second const int INF = 1e9 + 7; const int N = 1e6 + 1; int LIS(vector<int> a){ set<int> dp; for(int i = 0;i < (int)a.size(); i++){ int x = a[i]; if(dp.lower_bound(x) != dp.end()) dp.erase(dp.lower_bound(x)); dp.insert(x); } return (int)dp.size(); } main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int x; cin >> x; vector<int> a(n); for(int i = 0;i < n; i++){ cin >> a[i]; } vector<int> A = a; int ans = LIS(a); if(x == 0){ cout << ans; return 0; } for(int i = 0;i < n; i++){ a[i]+= -x; ans = max(ans, LIS(a)); } a = A; for(int i = n-1; i >= 0; i--){ a[i]+= x; ans = max(ans, LIS(a)); } cout << ans; return 0; }

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

glo.cpp:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main(){
      | ^~~~
#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...