#include "gondola.h"
#include <iostream>
#include<cstdio>
#include<stack>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[])
{
return -1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
int ind = -1;
int ct[n + 5];
stack <int> q;
vector< pair<int, int> >v;
for( int i = 0 ; i < n ; i++ ){
if( gondolaSeq[i] <= n ){
ind = i;
}
}
int nn = n + gondolaSeq[ind] - 1 - ind;
for( int i = 0 ; i < n ; i++ ){
ct[(nn + i) % n] = gondolaSeq[i];
}
for( int i = 0 ; i < n ; i++ ){
v.push_back( make_pair(ct[i], i));
}
sort( v.begin(), v.end());
for( int i = v.size() - 1 ; i >= 0 ; i-- ){
int ct1 = v[i].first;
if( ct1 <= n ) continue;
if( i == 0 ){
int ct2 = v[0].first - 1;
while( ct2 > n ){
q.push( ct2);
ct2--;
}
q.push(v[0].second + 1);
continue;
}
if( v[i - 1].first <= n ){
int ct2 = v[i].first - 1;
while( ct2 > n ){
q.push( ct2);
ct2--;
}
q.push(v[i].second + 1);
continue;
}
ct1--;
while( ct1 > v[i - 1].first){
q.push( ct1);
}
q.push( v[i].second + 1);
}
int ct3 = 0;
while( !q.empty() ){
replacementSeq[ct3] = q.top();
q.pop();
ct3++;
}
return ct3;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
488 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
552 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
552 KB |
Output is correct |
2 |
Correct |
2 ms |
552 KB |
Output is correct |
3 |
Correct |
2 ms |
580 KB |
Output is correct |
4 |
Correct |
3 ms |
588 KB |
Output is correct |
5 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
660 KB |
Output is correct |
2 |
Correct |
3 ms |
660 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
740 KB |
Output is correct |
5 |
Correct |
2 ms |
744 KB |
Output is correct |
6 |
Correct |
2 ms |
748 KB |
Output is correct |
7 |
Runtime error |
837 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
263168 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
263168 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
263168 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
263168 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
263168 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 |
Halted |
0 ms |
0 KB |
- |