# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639849 | a_aguilo | Global Warming (CEOI18_glo) | C++14 | 91 ms | 1916 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |