Submission #72196359
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int lis(vector<int> const& a) {
int n = a.size();
const int INF = 1e9;
vector<int> d(n+1, INF);
d[0] = -INF;
for (int i = 0; i < n; i++) {
int l = upper_bound(d.begin(), d.end(), a[i]) - d.begin();
if (d[l-1] < a[i] && a[i] < d[l])
d[l] = a[i];
}
int ans = 0;
for (int l = 0; l <= n; l++) {
if (d[l] < INF)
ans = l;
}
return ans;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin>>n;
pair<int, int> a[n+5];
for(int i=1; i<=n; i++){
cin>>a[i].first>>a[i].second;
a[i].second *= -1;
}
sort(a+1, a+1+n);
vector<int> b(n);
for(int i=1; i<=n; i++){
b[i-1] = -a[i].second;
}
cout<<lis(b)<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Kite |
| User | takeonicky |
| Language | C++ IOI-Style(GNU++20) (GCC 14.2.0) |
| Score | 450 |
| Code Size | 902 Byte |
| Status | AC |
| Exec Time | 45 ms |
| Memory | 4780 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 450 / 450 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_1_00.txt, 01_random_1_01.txt, 01_random_1_02.txt, 01_random_1_03.txt, 01_random_1_04.txt, 01_random_1_05.txt, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_sorted_00.txt, 03_sorted_01.txt, 03_sorted_02.txt, 03_sorted_03.txt, 03_sorted_04.txt, 03_sorted_05.txt, 04_same_coord_00.txt, 04_same_coord_01.txt, 04_same_coord_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 0 ms | 1580 KiB |
| 00_sample_01.txt | AC | 0 ms | 1580 KiB |
| 00_sample_02.txt | AC | 0 ms | 1580 KiB |
| 01_random_1_00.txt | AC | 27 ms | 3500 KiB |
| 01_random_1_01.txt | AC | 45 ms | 4780 KiB |
| 01_random_1_02.txt | AC | 37 ms | 4268 KiB |
| 01_random_1_03.txt | AC | 44 ms | 4780 KiB |
| 01_random_1_04.txt | AC | 44 ms | 4652 KiB |
| 01_random_1_05.txt | AC | 45 ms | 4780 KiB |
| 02_random_2_00.txt | AC | 43 ms | 4780 KiB |
| 02_random_2_01.txt | AC | 42 ms | 4780 KiB |
| 02_random_2_02.txt | AC | 42 ms | 4780 KiB |
| 02_random_2_03.txt | AC | 42 ms | 4780 KiB |
| 02_random_2_04.txt | AC | 40 ms | 4780 KiB |
| 02_random_2_05.txt | AC | 41 ms | 4780 KiB |
| 03_sorted_00.txt | AC | 44 ms | 4780 KiB |
| 03_sorted_01.txt | AC | 36 ms | 4780 KiB |
| 03_sorted_02.txt | AC | 43 ms | 4780 KiB |
| 03_sorted_03.txt | AC | 43 ms | 4780 KiB |
| 03_sorted_04.txt | AC | 36 ms | 4780 KiB |
| 03_sorted_05.txt | AC | 44 ms | 4780 KiB |
| 04_same_coord_00.txt | AC | 38 ms | 4780 KiB |
| 04_same_coord_01.txt | AC | 36 ms | 4780 KiB |
| 04_same_coord_02.txt | AC | 23 ms | 4780 KiB |