| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1292291 | BuiDucManh123 | LIS (INOI20_lis) | C++20 | 4086 ms | 916 KiB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define taskname ""
const int mod = 1e9+7;
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int lis(vector<int>& arr){
int n = arr.size();
vector<int> ans;
ans.pb(arr[0]);
for(int i = 1; i < n; i++){
if (arr[i] > ans.back()){
ans.pb(arr[i]);
}
else{
int low = lower_bound(ans.begin(), ans.end(), arr[i]) - ans.begin();
ans[low] = arr[i];
}
}
return ans.size();
}
void solve(){
int q;
cin >> q;
vector<int> a;
while(q--){
int x, v;
cin >> x >> v;
a.insert(a.begin() + x - 1, v);
cout << lis(a) << "\n";
}
}
signed main() {
if (fopen(taskname".inp","r")) {
freopen(taskname".inp","r",stdin);
freopen(taskname".out","w",stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int test = 1;
//cin >> test;
while(test--){
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
