#include "gondola.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const ll md = 1e9+7;
bool distinct(deque<int> S){
sort(S.begin(), S.end());
for(int i = 1; i < S.size(); i++) if(S[i] == S[i-1]) return 0;
return 1;
}
int valid(int n, int _S[]){
deque<int> S;
for(int i = 0; i < n; i++) S.pb(_S[i]);
int mn = *min_element(S.begin(), S.end());
while(S[0] != mn) S.pb(S[0]), S.pop_front();
if(!distinct(S)) return 0;
int ls = mn;
for(int i = 1; i < n; i++) if(S[i] <= n){
if(S[i] <= ls) return 0;
ls = S[i];
}
return 1;
}
int replacement(int n, int _S[], int R[]){
deque<int> S;
for(int i = 0; i < n; i++) S.pb(_S[i]);
int mn = *min_element(S.begin(), S.end());
while(S[0] != mn) S.pb(S[0]), S.pop_front();
return 0;
}
int countReplacement(int n, int _S[]){
deque<int> S;
for(int i = 0; i < n; i++) S.pb(_S[i]);
int mn = *min_element(S.begin(), S.end());
while(S[0] != mn) S.pb(S[0]), S.pop_front();
return 0;
}
Compilation message
gondola.cpp: In function 'bool distinct(std::deque<int>)':
gondola.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
14 | for(int i = 1; i < S.size(); i++) if(S[i] == S[i-1]) return 0;
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
304 KB |
Output is correct |
3 |
Correct |
0 ms |
308 KB |
Output is correct |
4 |
Correct |
0 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
5 ms |
960 KB |
Output is correct |
7 |
Correct |
12 ms |
1980 KB |
Output is correct |
8 |
Correct |
7 ms |
1584 KB |
Output is correct |
9 |
Correct |
3 ms |
596 KB |
Output is correct |
10 |
Correct |
10 ms |
1748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
4 ms |
964 KB |
Output is correct |
7 |
Correct |
12 ms |
1876 KB |
Output is correct |
8 |
Correct |
7 ms |
1588 KB |
Output is correct |
9 |
Correct |
3 ms |
596 KB |
Output is correct |
10 |
Correct |
8 ms |
1772 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |