#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;
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;
while( ct2 > n ){
q.push( ct2);
ct2--;
}
q.push(v[i].second + 1);
continue;
}
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 |
3 ms |
248 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
356 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
432 KB |
Integer -1 violates the range [0, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
636 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
636 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
636 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
636 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |