Atcoder Beginning Contest 134E (binary search (upper_bound), thinking)

#include <bits / STDC ++ H.>
the using namespace STD;
int A [100007], F [100007], ANS, n-;
int main () {
CIN n->>;
for (int I = n-; I> =. 1; Inc. (www.i-levelmedia.com))
Scanf ( "% D", A & [I]);
for (int I =. 1; I <= n-; I ++) // loop over
if (f [ans] <= a [i]) // if f is relatively small array, the array into a f array, so that a large position on ans
f [ans ++] = a [I];
the else
f [upper_bound, (. 1 + f, + f +. 1 ans, a [i]) - f] = a [i]; // f array is relatively large, turning it into a number of array, continue to look forward smaller, so that the string of long time stain
cout << ans; // ans f is the number of digits in the array, representing small numbers no way to find a smaller number together such that the front stain on the back
return 0;
}

Guess you like

Origin www.cnblogs.com/ldudxy/p/11225549.html