Submission #999172

# Submission time Handle Problem Language Result Execution time Memory
999172 2024-06-15T07:49:17 Z vjudge1 LIS (INOI20_lis) C++17
20 / 100
4000 ms 980 KB
#include <bits/stdc++.h> 
using namespace std; 
void solve(){
    int n,x,y; 
    cin >> n; 
    vector<int> c;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        c.insert(c.begin()+x-1,y);
        vector<int> dp; 
        for(auto x:c){
            int h=lower_bound(dp.begin(),dp.end(),x)-dp.begin();
            if(h==dp.size()){
                dp.push_back(x);
            }
            else{
                dp[h]=x;
            }
        }
        cout << dp.size() << "\n";
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    while(t--){
        solve();
    }
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:13:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |             if(h==dp.size()){
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 11 ms 348 KB Output is correct
4 Correct 13 ms 476 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 13 ms 348 KB Output is correct
7 Correct 12 ms 600 KB Output is correct
8 Correct 12 ms 348 KB Output is correct
9 Correct 13 ms 348 KB Output is correct
10 Correct 12 ms 348 KB Output is correct
11 Correct 13 ms 472 KB Output is correct
12 Correct 12 ms 480 KB Output is correct
13 Correct 15 ms 468 KB Output is correct
14 Correct 14 ms 464 KB Output is correct
15 Correct 13 ms 344 KB Output is correct
16 Correct 14 ms 348 KB Output is correct
17 Correct 14 ms 464 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 11 ms 348 KB Output is correct
4 Correct 13 ms 476 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 13 ms 348 KB Output is correct
7 Correct 12 ms 600 KB Output is correct
8 Correct 12 ms 348 KB Output is correct
9 Correct 13 ms 348 KB Output is correct
10 Correct 12 ms 348 KB Output is correct
11 Correct 13 ms 472 KB Output is correct
12 Correct 12 ms 480 KB Output is correct
13 Correct 15 ms 468 KB Output is correct
14 Correct 14 ms 464 KB Output is correct
15 Correct 13 ms 344 KB Output is correct
16 Correct 14 ms 348 KB Output is correct
17 Correct 14 ms 464 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
19 Execution timed out 4051 ms 980 KB Time limit exceeded
20 Halted 0 ms 0 KB -