제출 #639849

#제출 시각아이디문제언어결과실행 시간메모리
639849a_aguiloGlobal Warming (CEOI18_glo)C++14
10 / 100
91 ms1916 KiB
#include<bits/stdc++.h> using namespace std; int n, x; int binarySearch(int x, vector<int>& V){ int hi = V.size()-1; int lo = 0; while(hi >= lo){ int mid = lo + (hi - lo)/2; if(V[mid] < x) lo = mid+1; else hi = mid-1; } return lo; } int main(){ cin >> n >> x; vector<int> nums(n); for(int i = 0; i < n; ++i) cin >> nums[i]; vector<int> dp(1); dp[0] = nums[0]; for(int i = 1; i < nums.size(); ++i){ int pos = binarySearch(nums[i], dp); if(pos == dp.size()){ dp.push_back(nums[i]); } else dp[pos] = nums[i]; //cout << i <<" " << pos << endl; } cout << dp.size() << endl; return 0; }

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

glo.cpp: In function 'int main()':
glo.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 1; i < nums.size(); ++i){
      |                    ~~^~~~~~~~~~~~~
glo.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if(pos == 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...