제출 #243252

#제출 시각아이디문제언어결과실행 시간메모리
243252Kubin곤돌라 (IOI14_gondola)C++17
60 / 100
26 ms3968 KiB
#include <bits/stdc++.h> #ifndef XHOVA #include "gondola.h" #endif using namespace std; void normalize(int n, int A[]) { int k = -1; for(int i = 0; i < n and k == -1; i++) if(A[i] <= n) k = (n + i - (A[i]-1)) % n; if(k != -1) rotate(A, A + k, A + n); } int valid(int n, int A[]) { normalize(n, A); for(int i = 0; i < n; i++) if(A[i] <= n and A[i]-1 != i) return false; return unordered_set<int>(A, A + n).size() == (size_t)n; } int replacement(int n, int A[], int out[]) { normalize(n, A); vector<pair<int, int>> re; for(int i = 0; i < n; i++) if(A[i] > n) re.emplace_back(A[i], i); sort(re.begin(), re.end()); vector<int> B(n); iota(B.begin(), B.end(), 1); int l = 0; for(auto [x, i] : re) while(n+l < x) out[l++] = B[i], B[i] = n+l; return l; } constexpr uint Mod = 1e9 + 7; int countReplacement(int n, int A[]) { if(not valid(n, A)) return 0; }

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...