Submission #1017477

#TimeUsernameProblemLanguageResultExecution timeMemory
1017477Ice_manGondola (IOI14_gondola)C++14
20 / 100
32 ms5176 KiB
/** ____ ____ ____ __________________ ____ ____ ____ ||I || ||c || ||e || || || ||M || ||a || ||n || ||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__|| |/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\| */ #include <iostream> #include <chrono> #include <vector> #include <algorithm> #include <assert.h> #include <queue> #include <map> #include "gondola.h" #define maxn 1005 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef pair <ll, ll> pll; typedef pair <int, ll> pil; typedef pair <ll, int> pli; typedef long double ld; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } int valid(int n, int a[]) { map <int , int> br; int minn = INF , idx; for(int i = 0; i < n; i++) { if(minn > a[i]) { minn = a[i]; idx = i; } br[a[i]]++; if(br[a[i]] > 1) return false; } if(minn > n) return true; int curr = minn + 1; for(int i = idx + 1; i % n != idx; i++) { if(a[i % n] <= n && a[i % n] != curr) return false; curr++; } return true; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return 0; } int countReplacement(int n, int inputSeq[]) { return 0; } /**int main() { #ifdef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); ///startT = std::chrono::high_resolution_clock::now(); return 0; } */

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:57:22: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |     int minn = INF , idx;
      |                      ^~~
#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...