Submission #579092

#TimeUsernameProblemLanguageResultExecution timeMemory
579092MohamedFaresNebiliGondola (IOI14_gondola)C++14
25 / 100
9 ms1388 KiB
#include <bits/stdc++.h> #include "gondola.h" #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; using ll = long long; using ii = pair<int, int>; #define pb push_back #define pp pop_back #define ff first #define ss second typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; int valid(int n, int arr[]) { bool vis[250005]; memset(vis, 0, sizeof vis); for(int l = 0; l < n; l++) { if(vis[arr[l]]) return 0; vis[arr[l]] = 1; } int P = -1; for(int l = 0; l < n; l++) { if(arr[l] > n) continue; int K = arr[l] - l + n * 2; K %= n; if(P == -1) P = K; if(K != P) return 0; } return 1; } //---------------------- int replacement(int n, int arr[], int replacementSeq[]) { ii A[n]; int l = 0; while(l < n && arr[l] > n) l++; if(l == n) { for(l = 0; l < n; l++) A[l] = {arr[l], l}; } else { int V = arr[l]; for(int i = 0; i < n; l = (l + 1) % n, i++) { A[l] = {arr[l], V}; V = (V % n) + 1; } } sort(A, A + n); int curr = n + 1; int res = 0; for(auto E : A) { int U = E.ff, V = E.ss; while(U != V) { replacementSeq[res++] = V; V = curr; curr++; } } return res; } //---------------------- int countReplacement(int n, int inputSeq[]) { }

Compilation message (stderr)

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