Submission #635886

# Submission time Handle Problem Language Result Execution time Memory
635886 2022-08-27T09:27:47 Z K4YAN LIS (INOI20_lis) C++17
20 / 100
47 ms 556 KB
//Be Name Khoda

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define pll pair<ll, ll>
#define pllll pair<pll, pll>
#define all(x) x.begin(), x.end()

const ll mxn = 2e3 + 16;
ll n, t, q, w;
vector<ll> g, f, dp;

inline void input() {

    cin >> n;

}

inline void add() {
    f.clear(); dp.clear();
    for(int i = 0; i < q; i++) {
        f.push_back(g[i]);
    } f.push_back(w);
    for(int i = q; i < int(g.size()); i++) {
        f.push_back(g[i]);
    } g = f;
    return;
}
inline void cal_dp() {

    for(int i = 0; i < int(g.size()); i++) {
        q = lower_bound(all(dp), g[i]) - dp.begin();
        if(q == int(dp.size())) {
            dp.push_back(g[i]);
        } else {
            if(dp[q] > g[i]) {
                dp[q] = g[i];
            }
        }
    } return;

}

inline void solve() {

    if(n >= mxn) {
        cout << "Sadge\n";
        return;
    }
    while(n--) {
        cin >> q >> w; q--;
        add();
        cal_dp();
        cout << int(dp.size()) << "\n";
    } return;

}

int main() {

    ios::sync_with_stdio(false); cin.tie(NULL);

    input(), solve();

    return 0;
    
}
/*
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 17 ms 464 KB Output is correct
4 Correct 34 ms 340 KB Output is correct
5 Correct 17 ms 464 KB Output is correct
6 Correct 38 ms 444 KB Output is correct
7 Correct 21 ms 468 KB Output is correct
8 Correct 20 ms 340 KB Output is correct
9 Correct 21 ms 464 KB Output is correct
10 Correct 19 ms 460 KB Output is correct
11 Correct 20 ms 464 KB Output is correct
12 Correct 34 ms 464 KB Output is correct
13 Correct 39 ms 456 KB Output is correct
14 Correct 38 ms 444 KB Output is correct
15 Correct 36 ms 340 KB Output is correct
16 Correct 42 ms 340 KB Output is correct
17 Correct 47 ms 556 KB Output is correct
18 Correct 38 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 17 ms 464 KB Output is correct
4 Correct 34 ms 340 KB Output is correct
5 Correct 17 ms 464 KB Output is correct
6 Correct 38 ms 444 KB Output is correct
7 Correct 21 ms 468 KB Output is correct
8 Correct 20 ms 340 KB Output is correct
9 Correct 21 ms 464 KB Output is correct
10 Correct 19 ms 460 KB Output is correct
11 Correct 20 ms 464 KB Output is correct
12 Correct 34 ms 464 KB Output is correct
13 Correct 39 ms 456 KB Output is correct
14 Correct 38 ms 444 KB Output is correct
15 Correct 36 ms 340 KB Output is correct
16 Correct 42 ms 340 KB Output is correct
17 Correct 47 ms 556 KB Output is correct
18 Correct 38 ms 340 KB Output is correct
19 Incorrect 1 ms 336 KB Output isn't correct
20 Halted 0 ms 0 KB -