Submission #341066

#TimeUsernameProblemLanguageResultExecution timeMemory
341066mohamedsobhi777Gondola (IOI14_gondola)C++14
20 / 100
43 ms5228 KiB
#include <bits/stdc++.h>

using namespace std;
#define f first
#define s second
#include "gondola.h"

int valid(int n, int inputSeq[])
{
       map<int, int> mp;
       for (int i = 0; i < n; ++i)
              if (mp[inputSeq[i]]++)
                     return 0;
       if (*min_element(inputSeq, inputSeq + n) > n)
              return 1;
       for (int i = 0; i < n; ++i)
              inputSeq[i]--;

       auto check = [&](int i) -> bool {
              bool ret1 = 1;
              for (int j = 1; j < n; ++j)
              {
                     int nxt = (i + j) % n;
                     if (inputSeq[nxt] >= n)
                            continue;
                     if (inputSeq[nxt] != (inputSeq[i] + j) % n)
                            ret1 = 0;
              }
              return ret1 ;
       };
       for (int i = 0; i < n; ++i)
       {
              if (inputSeq[i] < n)
                     return check(i);
       }
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
       return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
       return -3;
}

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:10:22: warning: control reaches end of non-void function [-Wreturn-type]
   10 |        map<int, int> mp;
      |                      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...