voidsolve( ){ int n = read( ); for( int i = 1; i <= n; ++ i ) a[i] = read( ), pos[a[i]] = i; for( int i = 1; i <= n; ++ i ) b[i] = read( ), c[i] = pos[b[i]];
vector<int> g; for( int i = 1; i <= n; ++ i ) { int x = c[i]; auto it = lower_bound( g.begin( ), g.end( ), x ); if( it == g.end( ) ) g.push_back( x ); else *it = x; } cout << g.size( ) << '\n'; }
structKite { int a, b; booloperator < ( const Kite &oth ) const { if( a != oth.a ) return a < oth.a; return b > oth.b; } } A[maxn];
voidsolve( ){ int n = read( ); for( int i = 1; i <= n; ++ i ) A[i].a = read( ), A[i].b = read( ); sort( A + 1, A + n + 1 ); vector<int> g; for( int i = 1; i <= n; ++ i ) { auto [a, b] = A[i]; auto it = lower_bound( g.begin( ), g.end( ), b ); if( it == g.end( ) ) g.push_back( b ); else *it = b; } cout << g.size( ); }
voidsolve( ){ int x; while( cin >> x ) a[++ n] = x;
vector<int> d1; for( int i = 1; i <= n; ++ i ) { int x = -a[i]; auto it = upper_bound( d1.begin( ), d1.end( ), x ); if( it == d1.end( ) ) d1.push_back( x ); else *it = x; } cout << d1.size( ) << '\n';
vector<int> d2; for( int i = 1; i <= n; ++ i ) { int x = a[i]; auto it = lower_bound( d2.begin( ), d2.end( ), x ); if( it == d2.end( ) ) d2.push_back( x ); else *it = x; } cout << d2.size( ) << '\n'; }
boolcmp( Node a, Node b ){ if( a.A != b.A ) return a.A < b.A; return a.B < b.B; }
voidsolve( ){ int n = read( ); for( int i = 1; i <= n; ++ i ) { int t = read( ), x = read( ); a[i] = { t - x, t + x }; } sort( a + 1, a + n + 1, cmp ); vector<int> g; for( int i = 1; i <= n; ++ i ) { int x = -a[i].B; auto it = lower_bound( g.begin( ), g.end( ), x ); if( it == g.end( ) ) g.push_back( x ); else *it = x; } cout << g.size( ) << '\n'; }
voidsolve( ){ int n = read( ); for( int i = 1; i <= n; ++ i ) a[i] = read( ); vector<int> g; for( int i = 1; i <= n; ++ i ) { int x = a[i]; auto it = lower_bound( g.begin( ), g.end( ), x ); if( it == g.end( ) ) g.push_back( x ); else *it = x; } cout << n - (int)g.size( ) << '\n'; }
voidsolve( ){ int n = read( ); for( int i = 1; i <= n; ++ i ) { a[i] = read( ); }
vector<int> g; for( int i = 1; i <= n; ++ i ) { int x = a[i]; auto it = lower_bound( g.begin( ), g.end( ), x ); ed[i] = it - g.begin( ) + 1; if( it == g.end( ) ) g.push_back( x ); else *it = x; } int L = g.size( );
g.clear( ); for( int i = n; i >= 1; -- i ) { int x = -a[i]; auto it = lower_bound( g.begin( ), g.end( ), x ); st[i] = it - g.begin( ) + 1; if( it == g.end( ) ) g.push_back( x ); else *it = x; }
vector<int> res; for( int i = 1; i <= n; ++ i ) { if( ed[i] + st[i] - 1 == L ) res.push_back( i ); }
cout << res.size( ) << '\n'; for( int x : res ) cout << x << " "; cout << '\n'; }
vector<int> g; int cur = 1; for( int i = 1; i <= q; ++ i ) { auto [r, x, idx] = qs[i]; for( int j = cur; j <= r; ++ j ) { int val = a[j]; auto it = lower_bound( g.begin( ), g.end( ), val ); if( it == g.end( ) ) g.push_back( val ); else *it = val; } cur = r + 1; ans[idx] = upper_bound( g.begin( ), g.end( ), x ) - g.begin( ); }
for( int i = 1; i <= q; ++ i ) cout << ans[i] << '\n'; }