#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
struct Arret
{
int borneMax, vitesseSortie;
bool operator < (const Arret &autre) const
{
if (borneMax != autre.borneMax)
return borneMax > autre.borneMax;
return vitesseSortie > autre.vitesseSortie;
}
};
multiset<Arret> arrets;
long long plan_roller_coaster(vector<int> s, vector<int> t){
int nArrets = s.size();
for (int iArret = 0; iArret < nArrets; ++iArret)
arrets.insert({s[iArret], t[iArret]});
Arret arretCur = *arrets.begin();
arrets.erase(arrets.begin());
for (; !arrets.empty(); ){
Arret prochainArret = *arrets.lower_bound({arretCur.vitesseSortie, 0});
if (arrets.lower_bound({arretCur.vitesseSortie, 0}) == arrets.end())
return 0;
arrets.erase(prochainArret);
arretCur = prochainArret;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
256 KB |
n = 2 |
4 |
Correct |
2 ms |
256 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
376 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
256 KB |
n = 2 |
4 |
Correct |
2 ms |
256 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
376 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
16764 KB |
n = 199999 |
2 |
Incorrect |
253 ms |
16808 KB |
answer is not correct: 0 instead of 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
256 KB |
n = 2 |
4 |
Correct |
2 ms |
256 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
376 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |