#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t)
{
#define int long long
int n = (int)s.size();
vector<pair<int, int>> ss, tt;
for(int i=0;i<n;i++)
{
tt.push_back({t[i], i});
ss.push_back({s[i], i});
}
sort(ss.rbegin(), ss.rend());
sort(tt.rbegin(), tt.rend());
int i = 1, j = 0;
while(i < n)
{
if(ss[i].second != tt[j].second)
{
if(tt[j].first > ss[i].first)
return 999;
}
else
{
if(tt[j].first > ss[i + 1].first)
return 999;
}
i++, j++;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
0 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
0 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
9892 KB |
n = 199999 |
2 |
Correct |
66 ms |
9888 KB |
n = 199991 |
3 |
Correct |
67 ms |
9908 KB |
n = 199993 |
4 |
Correct |
49 ms |
9020 KB |
n = 152076 |
5 |
Correct |
31 ms |
4992 KB |
n = 93249 |
6 |
Incorrect |
60 ms |
9900 KB |
answer is not correct: 1 instead of 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
0 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 0 |
6 |
Halted |
0 ms |
0 KB |
- |