#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 2;
int valid(int n, int inputSeq[])
{
vector <pair <int, int> > v;
for(int i = 0; i < n; i ++)
if(inputSeq[i] <= n)
v.push_back({inputSeq[i], i + 1});
sort(v.begin(), v.end());
for(int i = 1; i < v.size(); i ++){
int ab = v[i].first - v[i - 1].first, ds;
if(v[i].second > v[i - 1].second){
ds = v[i].second - v[i - 1].second;
} else {
ds = v[i].second + (n - v[i - 1].second);
}
if(ds != ab) return 0;
}
sort(inputSeq, inputSeq + n);
for(int i = 1; i < n; i ++){
if(inputSeq[i] == inputSeq[i - 1]) return 0;
}
return 1;
}
//----------------------
int used[N];
int replacement(int n, int gondolaSeq[], int rp[])
{
int sz = 0, mx = 0;
for(int i = 0; i < n; i ++){
used[gondolaSeq[i]] = 1;
mx = max(mx, gondolaSeq[i]);
}
for(int i = 1; i <= mx; i ++){
if(!used[i]){
rp[sz ++] = i;
}
}
return sz;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
Compilation message
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:14:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < v.size(); i ++){
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
480 KB |
Output is correct |
4 |
Correct |
2 ms |
480 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
592 KB |
Output is correct |
2 |
Correct |
2 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
632 KB |
Output is correct |
4 |
Correct |
2 ms |
632 KB |
Output is correct |
5 |
Correct |
2 ms |
632 KB |
Output is correct |
6 |
Correct |
13 ms |
1276 KB |
Output is correct |
7 |
Correct |
22 ms |
1908 KB |
Output is correct |
8 |
Correct |
18 ms |
1908 KB |
Output is correct |
9 |
Correct |
10 ms |
1908 KB |
Output is correct |
10 |
Correct |
31 ms |
1992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1992 KB |
Output is correct |
2 |
Correct |
2 ms |
1992 KB |
Output is correct |
3 |
Correct |
2 ms |
1992 KB |
Output is correct |
4 |
Correct |
2 ms |
1992 KB |
Output is correct |
5 |
Correct |
2 ms |
1992 KB |
Output is correct |
6 |
Correct |
16 ms |
1992 KB |
Output is correct |
7 |
Correct |
25 ms |
2020 KB |
Output is correct |
8 |
Correct |
18 ms |
2144 KB |
Output is correct |
9 |
Correct |
14 ms |
2144 KB |
Output is correct |
10 |
Correct |
29 ms |
2144 KB |
Output is correct |
11 |
Correct |
2 ms |
2144 KB |
Output is correct |
12 |
Correct |
2 ms |
2144 KB |
Output is correct |
13 |
Correct |
7 ms |
2144 KB |
Output is correct |
14 |
Correct |
3 ms |
2144 KB |
Output is correct |
15 |
Correct |
24 ms |
2144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2144 KB |
Output is correct |
2 |
Correct |
2 ms |
2144 KB |
Output is correct |
3 |
Correct |
2 ms |
2144 KB |
Output is correct |
4 |
Correct |
2 ms |
2144 KB |
Output is correct |
5 |
Correct |
2 ms |
2144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2144 KB |
Output is correct |
2 |
Correct |
2 ms |
2144 KB |
Output is correct |
3 |
Correct |
2 ms |
2144 KB |
Output is correct |
4 |
Correct |
2 ms |
2144 KB |
Output is correct |
5 |
Correct |
2 ms |
2144 KB |
Output is correct |
6 |
Correct |
2 ms |
2144 KB |
Output is correct |
7 |
Incorrect |
3 ms |
2144 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2144 KB |
Output is correct |
2 |
Correct |
2 ms |
2144 KB |
Output is correct |
3 |
Correct |
2 ms |
2144 KB |
Output is correct |
4 |
Correct |
3 ms |
2144 KB |
Output is correct |
5 |
Correct |
2 ms |
2144 KB |
Output is correct |
6 |
Correct |
2 ms |
2144 KB |
Output is correct |
7 |
Incorrect |
3 ms |
2144 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2144 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2144 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2144 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2144 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |