Submission #1072875

# Submission time Handle Problem Language Result Execution time Memory
1072875 2024-08-24T06:14:07 Z Cyanberry Global Warming (CEOI18_glo) C++14
10 / 100
65 ms 4812 KB
// earth cooling
#include <bits/stdc++.h>
using namespace std;

#define int long long
signed main() {
    int dayc, limit;
    cin>>dayc>>limit;
    int days[dayc];
    for (int i = 0; i < dayc; ++i) {
        cin>>days[i];
    }
    vector<int> LISs[2];
    for (int i=0; i < dayc; ++i) {
        if (LISs[0].size() > 0) {
            int l = -1, r = LISs[0].size();
            while (r - l > 1) {
                int m = (r+l)/2;
                if (LISs[0][m] >= days[i]) {
                    r = m;
                } else {
                    l = m;
                }
            }
            if (r >= LISs[0].size()) {
                LISs[0].push_back(days[i]);
            } else {
                LISs[0][r] = min(LISs[0][r], days[i]);
            }
            days[i] += limit;
            l = -1, r = LISs[0].size();
            while (r - l > 1) {
                int m = (r+l)/2;
                if (LISs[0][m] >= days[i]) {
                    r = m;
                } else {
                    l = m;
                }
            }
            if (r >= LISs[1].size()) {
                LISs[1].push_back(days[i]);
            } else {
                LISs[1][r] = min(LISs[1][r], days[i]);
            }
            l = -1, r = LISs[1].size();
            while (r - l > 1) {
                int m = (r+l)/2;
                if (LISs[1][m] >= days[i]) {
                    r = m;
                } else {
                    l = m;
                }
            }
            if (r >= LISs[1].size()) {
                LISs[1].push_back(days[i]);
            } else {
                LISs[1][r] = min(LISs[1][r], days[i]);
            }
        } else {
            LISs[0].push_back(days[i]);
            LISs[1].push_back(days[i] + limit);
        }
    }
    // for (int i : LISs[0]) {
    //     cout<<i<<' ';
    // }
    // cout<<'\n';
    // for (int i : LISs[1]) {
    //     cout<<i<<' ';
    // }
    // cout<<'\n';
    cout<<LISs[1].size();
}

Compilation message

glo.cpp: In function 'int main()':
glo.cpp:25: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]
   25 |             if (r >= LISs[0].size()) {
      |                 ~~^~~~~~~~~~~~~~~~~
glo.cpp:40: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]
   40 |             if (r >= LISs[1].size()) {
      |                 ~~^~~~~~~~~~~~~~~~~
glo.cpp:54: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]
   54 |             if (r >= LISs[1].size()) {
      |                 ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 3760 KB Output is correct
2 Correct 62 ms 3744 KB Output is correct
3 Correct 64 ms 3760 KB Output is correct
4 Correct 63 ms 3872 KB Output is correct
5 Correct 56 ms 4812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2140 KB Output is correct
2 Correct 31 ms 2324 KB Output is correct
3 Incorrect 61 ms 3760 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -