This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define int ll
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using pii = pair<int, int>;
int m, n;
int arr[3][202020];
set <int> s;
void solve_2()
{
vector <pii> v;
for (int i = 0; i < n; i++)
v.push_back({arr[0][i], arr[1][i]});
sort(all(v));
vector <int> vv;
for (int i = 0; i < n; i++)
vv.push_back(v[i].second);
set <int> :: iterator it;
for (int i = 0; i < n; i++)
{
s.insert(vv[i]);
it = s.upper_bound(vv[i]);
if (it != s.end())
s.erase(it);
}
cout << s.size() << '\n';
}
void solve_3(){return;}
int32_t main()
{
usecppio
cin >> m >> n;
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
cin >> arr[i][j];
if (m == 2)
solve_2();
else solve_3();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |