제출 #713776

#제출 시각아이디문제언어결과실행 시간메모리
713776HydrolyzedGlobal Warming (CEOI18_glo)C++14
10 / 100
45 ms3012 KiB
/* * AUTHOR : Hydrolyzed~ * SCHOOL : RYW * TASK : Global Warming * ALGO : Dynamic Programming * DATE : 23 Mar 2023 * */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #ifndef _DEBUG // @==== Libary ====@ // // @================@ // #endif using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ; // @=== Debugger ===@ // #ifdef _DEBUG #include "debug.hpp" #else #define dbg(...) 0 #endif // @================@ // using ll = long long; inline void solution(){ int n, x; cin >> n >> x; vector<int> a(n + 1), dp; for(int i=1; i<=n; ++i){ cin >> a[i]; } for(int i=1; i<=n; ++i){ int idx = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin(); if(idx == dp.size()){ dp.emplace_back(a[i]); } else{ dp[idx] = a[i]; } } cout << dp.size(); return ; } signed main(){ cin.tie(nullptr)->ios::sync_with_stdio(false); int q = 1; // cin >> q; while(q--){ solution(); cout << "\n"; } return 0; } // https://github.com/MasterIceZ/archive/tree/main/cpp-template

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

glo.cpp: In function 'void solution()':
glo.cpp:45:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   if(idx == dp.size()){
      |      ~~~~^~~~~~~~~~~~
#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...