This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <gondola.h>
using namespace std;
int valid(int n, int inputSeq[]) {
int done[250001] = {};
vector<int> a;
int check = 1;
for (int i = 0; i < n; i++) {
done[inputSeq[i]]++;
if (done[inputSeq[i]] > 1)
check = 0;
if (inputSeq[i] <= n)
a.push_back(inputSeq[i]);
}
int pos = -1, val = n + 1;
for (int i = 0; i < a.size(); i++) {
if (a[i] < val)
val = a[i], pos = i;
}
for (int i = 0, j = pos + 1; i < a.size() - 1; i++, j++) {
if (j == a.size())
j = 0;
if (a[j] <= val)
check = 0;
val = a[j];
}
return check;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
return 1;
}
int countReplacement(int n, int inputSeq[]) {
return 1;
}
/*int gondolaSequence[100001];
int replacementSequence[250001];
int main()
{
int i, n, tag;
int nr;
assert(scanf("%d", &tag)==1);
assert(scanf("%d", &n)==1);
for(i=0;i< n;i++)
assert( scanf("%d", &gondolaSequence[i]) ==1);
switch (tag){
case 1: case 2: case 3:
printf("%d\n", valid(n, gondolaSequence));
break;
case 4: case 5: case 6:
nr = replacement(n, gondolaSequence, replacementSequence);
printf("%d ", nr);
if (nr > 0)
{
for (i=0; i<nr-1; i++)
printf("%d ", replacementSequence[i]);
printf("%d\n", replacementSequence[nr-1]);
}
else printf("\n");
break;
case 7: case 8: case 9: case 10:
printf("%d\n", countReplacement(n, gondolaSequence));
break;
}
return 0;
}*/
Compilation message (stderr)
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < a.size(); i++) {
~~^~~~~~~~~~
gondola.cpp:23:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0, j = pos + 1; i < a.size() - 1; i++, j++) {
~~^~~~~~~~~~~~~~
gondola.cpp:24:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (j == a.size())
~~^~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |