Submission #789674

# Submission time Handle Problem Language Result Execution time Memory
789674 2023-07-21T17:47:25 Z fatemetmhr Roller Coaster Railroad (IOI16_railroad) C++17
0 / 100
95 ms 8892 KB
//  ~ Be Name Khoda ~  //

#include "railroad.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  5e5   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

vector <int> av;
int cnt[maxn5];

long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = s.size();
    for(int i = 0; i < n; i++)
        av.pb(t[i]);
    sort(all(av));
    av.resize(unique(all(av)) - av.begin());
    for(int i = 0; i < n; i++){
        int pt = lower_bound(all(av), t[i]) - av.begin();
        cnt[pt]--;
        pt = upper_bound(all(av), s[i]) - av.begin() - 1;
        if(pt >= 0)
            cnt[pt]++;
    }
    int br = 0;
    int cur = 0;
    for(int i = int(av.size()) - 1; i >= 0; i--){
        cur += cnt[i];
        if(cur < 0)
            br += cur;
    }
    return br <= 1 ? 0 : 1;
}












# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 1 ms 212 KB n = 2
4 Correct 1 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 1 ms 212 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 1 ms 212 KB n = 2
4 Correct 1 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 1 ms 212 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 88 ms 8872 KB n = 199999
2 Incorrect 95 ms 8892 KB answer is not correct: 0 instead of 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 1 ms 212 KB n = 2
4 Correct 1 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 1 ms 212 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -