Submission #589029

#TimeUsernameProblemLanguageResultExecution timeMemory
589029FatihSolakGondola (IOI14_gondola)C++17
20 / 100
58 ms8632 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]){ set<int> s; map<int,int> pos; for(int i = 0;i<n;i++){ s.insert(inputSeq[i]); pos[inputSeq[i]] = i; } if(s.size() != n)return 0; int num = *s.begin() + 1; while(num <= n){ if(pos[num] != (pos[num-1] + 1)%n){ return 0; } num++; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]){ int pos_mini = 0; for(int i = 1;i<n;i++){ if(gondolaSeq[i] < gondolaSeq[pos_mini]){ pos_mini = i; } } int tmp[n]; for(int i = 0;i<n;i++)tmp[i] = gondolaSeq[i]; for(int i = 0;i<n;i++){ gondolaSeq[i] = tmp[(pos_mini + i)%n]; //cout << gondolaSeq[i] << " "; } //cout << endl; for(int i = n + 1;i<=gondolaSeq[n-1];i++){ if(gondolaSeq[0] <= i){ replacementSeq[i - n - 1] = i - gondolaSeq[0]; } else{ replacementSeq[i - n - 1] = 0; } } return gondolaSeq[n-1] - n; } //---------------------- int countReplacement(int n, int inputSeq[]){ return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:11:14: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |  if(s.size() != n)return 0;
      |     ~~~~~~~~~^~~~
#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...