답안 #999158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999158 2024-06-15T07:29:06 Z vjudge1 LIS (INOI20_lis) C++17
20 / 100
4000 ms 1492 KB
#include <bits/stdc++.h>

#define int long long
// #define ll long long
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
const int oo = 1e18 + 9;
const int MAX = 1e6 + 5, LOGMAX = 20, B = 800, MOD = 1e9 + 7;

vector<int> v;

void solve(){
    int q; cin >> q;
    while(q--){
        int p, x; cin >> p >> x;
        v.insert(v.begin() + p - 1, x);
        vector<int> d;
        for(int i = 0; i < v.size(); i++){
            int id = lower_bound(all(d), v[i]) - d.begin();
            if(id == d.size()) d.push_back(v[i]);
            else d[id] = v[i];
        }
        cout << d.size() << '\n';
    }
}   

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while(t--) solve();
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:19:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int i = 0; i < v.size(); i++){
      |                        ~~^~~~~~~~~~
Main.cpp:21:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if(id == d.size()) d.push_back(v[i]);
      |                ~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 11 ms 512 KB Output is correct
4 Correct 14 ms 344 KB Output is correct
5 Correct 10 ms 348 KB Output is correct
6 Correct 14 ms 500 KB Output is correct
7 Correct 13 ms 488 KB Output is correct
8 Correct 13 ms 348 KB Output is correct
9 Correct 16 ms 348 KB Output is correct
10 Correct 12 ms 512 KB Output is correct
11 Correct 14 ms 344 KB Output is correct
12 Correct 13 ms 344 KB Output is correct
13 Correct 15 ms 504 KB Output is correct
14 Correct 15 ms 348 KB Output is correct
15 Correct 14 ms 512 KB Output is correct
16 Correct 15 ms 348 KB Output is correct
17 Correct 17 ms 348 KB Output is correct
18 Correct 15 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 11 ms 512 KB Output is correct
4 Correct 14 ms 344 KB Output is correct
5 Correct 10 ms 348 KB Output is correct
6 Correct 14 ms 500 KB Output is correct
7 Correct 13 ms 488 KB Output is correct
8 Correct 13 ms 348 KB Output is correct
9 Correct 16 ms 348 KB Output is correct
10 Correct 12 ms 512 KB Output is correct
11 Correct 14 ms 344 KB Output is correct
12 Correct 13 ms 344 KB Output is correct
13 Correct 15 ms 504 KB Output is correct
14 Correct 15 ms 348 KB Output is correct
15 Correct 14 ms 512 KB Output is correct
16 Correct 15 ms 348 KB Output is correct
17 Correct 17 ms 348 KB Output is correct
18 Correct 15 ms 348 KB Output is correct
19 Execution timed out 4030 ms 1492 KB Time limit exceeded
20 Halted 0 ms 0 KB -