Submission #1097169

# Submission time Handle Problem Language Result Execution time Memory
1097169 2024-10-06T11:06:03 Z papi Global Warming (CEOI18_glo) C++14
10 / 100
37 ms 1624 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define I2 pair <int, int>
#define L2 pair <long long, long long>
#define IL pair <int, long long>
#define LI pair <long long, int>

using namespace std;

const int MAXN = 1e6 + 7, MOD = 1e9 + 7, base = 31;
const long long oo = 1e18;
int DX[] = {0, -1, 0, 1}, DY[] = {-1, 0, 1, 0};

int n, ans;
int lis[MAXN], a[MAXN];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if (fopen("TEXT.INP", "r")){
        freopen("TEXT.INP", "r", stdin);
        freopen("TEXT.OUT", "w", stdout);
    }
    int x;
    cin >> n >> x;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }
    lis[1] = a[1];
    for (int i = 2; i <= n; i++){
        int k = lower_bound(lis + 1, lis + ans + 1, a[i]) - lis;
        lis[k] = a[i];
        ans = max(ans, k);
    }
    cout << ans;
    return 0;
}


Compilation message

glo.cpp: In function 'int main()':
glo.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen("TEXT.INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
glo.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen("TEXT.OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1116 KB Output is correct
2 Correct 36 ms 1116 KB Output is correct
3 Correct 23 ms 1116 KB Output is correct
4 Correct 37 ms 1104 KB Output is correct
5 Correct 13 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Incorrect 3 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -