Submission #999158

#TimeUsernameProblemLanguageResultExecution timeMemory
999158vjudge1LIS (INOI20_lis)C++17
20 / 100
4030 ms1492 KiB
#include <bits/stdc++.h> #define int long long // #define ll long long #define pii pair<int, int> #define all(v) v.begin(), v.end() using namespace std; const int oo = 1e18 + 9; const int MAX = 1e6 + 5, LOGMAX = 20, B = 800, MOD = 1e9 + 7; vector<int> v; void solve(){ int q; cin >> q; while(q--){ int p, x; cin >> p >> x; v.insert(v.begin() + p - 1, x); vector<int> d; for(int i = 0; i < v.size(); i++){ int id = lower_bound(all(d), v[i]) - d.begin(); if(id == d.size()) d.push_back(v[i]); else d[id] = v[i]; } cout << d.size() << '\n'; } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while(t--) solve(); }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:19:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int i = 0; i < v.size(); i++){
      |                        ~~^~~~~~~~~~
Main.cpp:21:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if(id == d.size()) d.push_back(v[i]);
      |                ~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...