Submission #582250

#TimeUsernameProblemLanguageResultExecution timeMemory
582250kamelfanger83Gondola (IOI14_gondola)C++14
55 / 100
18 ms2124 KiB
#include <iostream> #include <vector> #include "gondola.h" #include <limits> #include <numeric> #include <algorithm> using namespace std; int valid(int n, int inputSeq[]){ int one = numeric_limits<int>::min(); vector<bool> used (250001, false); for(int c = 0; c < n; c++){ if(inputSeq[c] <= n){ if(one == numeric_limits<int>::min()) one = c - inputSeq[c] + 1; if((c - one + 1) % n != inputSeq[c] % n) return 0; } else{ if(used[inputSeq[c]]) return 0; used[inputSeq[c]] = true; } } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ int one = 0; for(int c = 0; c < n; c++){ if(gondolaSeq[c] <= n) one = c - gondolaSeq[c] + 1; } vector<int> ind (n); iota(ind.begin(), ind.end(), 0); auto gcomp = [&](int u, int v){return gondolaSeq[u] < gondolaSeq[v];}; sort(ind.begin(), ind.end(), gcomp); int repg = n; int l = 0; vector<int> ac (n); for(int acer = 0; acer < n; acer++){ int num = (acer - one + 1 + n) % n; if(num == 0) num = n; ac[acer] = num; } for(int rep : ind){ while(repg < gondolaSeq[rep]){ replacementSeq[l++] = ac[rep]; repg++; ac[rep] = repg; } } return l; } int countReplacement(int n, int inputSeq[]){ }

Compilation message (stderr)

gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:56:1: warning: no return statement in function returning non-void [-Wreturn-type]
   56 | }
      | ^
#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...