Submission #226079

# Submission time Handle Problem Language Result Execution time Memory
226079 2020-04-22T13:31:33 Z VEGAnn Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
123 ms 11496 KB
#include <bits/stdc++.h>
#include "railroad.h"
#define pii pair<int,int>
#define MP make_pair
#define PB push_back
#define ft first
#define sd second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
using namespace std;
const int oo = int(1e9) + 1;
vector<pii> vc;
int n;

long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    n = (int) s.size();

    vc.PB(MP(1, -1));
    vc.PB(MP(oo, +1));

    for (int i = 0; i < n; i++)
        if (s[i] < t[i]){
            vc.PB(MP(s[i], +1));
            vc.PB(MP(t[i], -1));
        } else {
            vc.PB(MP(s[i], -1));
            vc.PB(MP(t[i], +1));
        }

    sort(all(vc));

    int sm = 0;

    for (int i = 0; i < sz(vc); ){

        if (sm > 0) return 1;

        int j = i;

        while (j < sz(vc) && vc[i].ft == vc[j].ft){
            sm += vc[j].sd;
            j++;
        }

        i = j;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 11496 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -