Submission #68971

# Submission time Handle Problem Language Result Execution time Memory
68971 2018-08-19T11:46:37 Z Kubalionzzale Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
436 ms 23436 KB
#include "railroad.h"

#include <iostream>
#include <algorithm>
#include <functional>
#include <set>
#include <map>

int n;
std::pair<int, int> a[200010];
std::map< std::pair<int, int>, int, std::greater< std::pair<int, int> > > mapa;
//first - output speed, second - index

bool compare(const std::pair<int, int> &lhs, const std::pair<int, int> &rhs)
{
    if (lhs.first != rhs.first)
        return lhs.second < rhs.second;
    else
        return lhs.first < rhs.first;
}

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

    for (int i = 0; i < n; ++i)
    {
        a[i].first = s[i];
        a[i].second = t[i];

        mapa.insert(std::make_pair(std::make_pair(t[i], i), 0));
    }

    mapa.insert(std::make_pair(std::make_pair(1, -1), 0));

    int cnt = 1;
    for (auto it = mapa.begin(); it != mapa.end(); ++it)
    {
        it->second = cnt;
        ++cnt;
    }

    std::sort(a, a + n, compare);
    for (int i = 0; i < n; ++i)
    {
        auto it = mapa.lower_bound(std::make_pair(s[i], 1e6));

        if (it->second < (n - i))
            return 0;

    }

    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB n = 2
2 Correct 3 ms 460 KB n = 2
3 Correct 4 ms 580 KB n = 2
4 Correct 3 ms 580 KB n = 2
5 Correct 3 ms 580 KB n = 2
6 Incorrect 4 ms 580 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB n = 2
2 Correct 3 ms 460 KB n = 2
3 Correct 4 ms 580 KB n = 2
4 Correct 3 ms 580 KB n = 2
5 Correct 3 ms 580 KB n = 2
6 Incorrect 4 ms 580 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 436 ms 19456 KB n = 199999
2 Incorrect 409 ms 23436 KB answer is not correct: 0 instead of 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB n = 2
2 Correct 3 ms 460 KB n = 2
3 Correct 4 ms 580 KB n = 2
4 Correct 3 ms 580 KB n = 2
5 Correct 3 ms 580 KB n = 2
6 Incorrect 4 ms 580 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -