Submission #194138

#TimeUsernameProblemLanguageResultExecution timeMemory
194138oscarsierra12Gondola (IOI14_gondola)C++14
20 / 100
56 ms5616 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std ; int valid(int n, int inputSeq[]) { int x = min_element ( inputSeq, inputSeq+n ) - inputSeq ; vector <int> nwSeq ; set <int> rep ; for ( int i = x ; i < n ; ++i ) nwSeq.push_back ( inputSeq[i] ), rep.insert ( inputSeq[i] ) ; for ( int i = 0 ; i < x ; ++i ) nwSeq.push_back ( inputSeq[i] ), rep.insert ( inputSeq[i] ) ; int expected = inputSeq[x] ; int posible = ( rep.size()==n ) ; for ( int i = 0 ; i < n ; ++i ) { if ( nwSeq[i] <= n ) { if ( nwSeq[i] != expected ) posible = 0 ; expected = nwSeq[i]+1 ; } else expected++ ; } return posible; } //---------------------- 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:12:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   int posible = ( rep.size()==n ) ;
                   ~~~~~~~~~~^~~
#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...