Submission #361600

# Submission time Handle Problem Language Result Execution time Memory
361600 2021-01-30T19:04:34 Z gratus907 None (KOI18_matrix) C++17
29 / 100
134 ms 21596 KB
#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
1 Correct 6 ms 1132 KB Output is correct
2 Correct 5 ms 1132 KB Output is correct
3 Correct 5 ms 1152 KB Output is correct
4 Correct 5 ms 1132 KB Output is correct
5 Correct 5 ms 1132 KB Output is correct
6 Correct 6 ms 1392 KB Output is correct
7 Correct 5 ms 1136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1132 KB Output is correct
2 Correct 5 ms 1132 KB Output is correct
3 Correct 5 ms 1152 KB Output is correct
4 Correct 5 ms 1132 KB Output is correct
5 Correct 5 ms 1132 KB Output is correct
6 Correct 6 ms 1392 KB Output is correct
7 Correct 5 ms 1136 KB Output is correct
8 Correct 108 ms 14176 KB Output is correct
9 Correct 106 ms 14076 KB Output is correct
10 Correct 108 ms 14300 KB Output is correct
11 Correct 94 ms 14300 KB Output is correct
12 Correct 104 ms 14172 KB Output is correct
13 Correct 128 ms 16736 KB Output is correct
14 Correct 107 ms 14176 KB Output is correct
15 Correct 80 ms 14196 KB Output is correct
16 Correct 134 ms 21596 KB Output is correct
17 Correct 132 ms 16732 KB Output is correct
18 Correct 109 ms 16240 KB Output is correct
19 Correct 104 ms 14176 KB Output is correct
20 Correct 122 ms 14176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -