Submission #389193

#TimeUsernameProblemLanguageResultExecution timeMemory
389193Pichon5Gondola (IOI14_gondola)C++17
20 / 100
40 ms4564 KiB
#include "gondola.h" #include<bits/stdc++.h> #define vi vector<int> #define pb push_back #define F first #define S second using namespace std; int valid(int n, int v[]) { int pos1=0; set<int>st; for(int i=0;i<n;i++){ if(v[i]<=n){ int B=v[i]-1; if(i-B>=0){ pos1=i-B; }else{ B-=i; pos1=n-B; } } if(v[i]<=0)return 0; st.insert(v[i]); } if(st.size()!=n)return 0; int pos=pos1; for(int i=1;i<=n;i++){ if(v[i]>n)continue; if(v[pos]!=i)return 0; pos++; if(pos==n)pos=0; } return 1; } //---------------------- 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:25:17: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     if(st.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...