Submission #782686

#TimeUsernameProblemLanguageResultExecution timeMemory
782686MISM06LIS (INOI20_lis)C++17
20 / 100
58 ms456 KiB
//0 1 1 0 1 //0 1 0 0 1 //1 0 0 1 1 //0 1 1 0 1 #include <bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx2") using namespace std; #define F first #define S second #define pb push_back #define sze size() #define all(x) x.begin() , x.end() #define wall__ cout << "--------------------------------------\n"; #define kids int mid = (tl + tr) >> 1, cl = v << 1, cr = v << 1 | 1 #define file_io freopen("input.cpp", "r", stdin); freopen("output.cpp", "w", stdout); typedef long long ll; typedef long double dl; typedef pair < int , int > pii; typedef pair < int , ll > pil; typedef pair < ll , int > pli; typedef pair < ll , ll > pll; typedef pair < int , pii > piii; typedef pair < ll, pll > plll; const ll N = 2000 + 10; const ll mod = 1e9 + 7; const ll inf = 2e16; const ll INF = 1e9 + 10; const ll lg = 32; int n, dp[N], p[N], a[N]; void solve () { cin >> n; for (int i = 1; i <= n; i++) { cin >> p[i] >> a[i]; } if (n > 2000) return; vector < int > b, c; for (int i = 1; i <= n; i++) { while(b.sze > p[i] - 1) { c.pb(b.back()); b.pop_back(); } b.pb(a[i]); while(c.sze) { b.pb(c.back()); c.pop_back(); } fill(dp, dp + N, INF); dp[0] = 0; int ans = 0; for (int j = 0; j < b.sze; j++) { int x = b[j]; int it = lower_bound(dp, dp + N, x) - dp; dp[it] = min(dp[it], x); ans = max(ans, it); } cout << ans << '\n'; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t--) {solve();} return 0; } /* */ //shrek is love;

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:47:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |   while(b.sze > p[i] - 1) {
      |         ~~~~~~^~~~~~~~~~
Main.cpp:57:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   for (int j = 0; j < b.sze; j++) {
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...