이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <gondola.h>
#define taskname "test"
#define fi first
#define se second
#define pb push_back
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pil = pair <int, ll>;
using pli = pair <ll, int>;
using pll = pair <ll, ll>;
using ull = unsigned ll;
mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count());
ll min(const ll &a, const ll &b){
return (a < b) ? a : b;
}
ll max(const ll &a, const ll &b){
return (a > b) ? a : b;
}
const ll Mod = 1000000007;
const ll Mod2 = 999999999989;
const int maxN = 1e5 + 1;
int n;
int valid(int N, int inputSeq[]){
n = N;
map <int, bool> mp;
int pivot, cnt = 0, tem = INT_MAX;
for (int i = 0; i < n; ++i){
if (mp[inputSeq[i]]) return 0;
mp[inputSeq[i]] = 1;
if (inputSeq[i] > n) ++cnt;
if (tem > inputSeq[i]){
tem = inputSeq[i];
pivot = i;
}
}
if (cnt == n) return 1;
//pivot is where the number one is supposed to be at
pivot = ((pivot - tem + 1) + n) % n;
for (int i = pivot; i < pivot + n; ++i){
if (inputSeq[i % n] <= n && inputSeq[i % n] != i - pivot + 1){
return 0;
}
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
return 1;
}
int countReplacement(int n, int inputSeq[]){
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:46:21: warning: 'pivot' may be used uninitialized in this function [-Wmaybe-uninitialized]
46 | pivot = ((pivot - tem + 1) + n) % n;
| ~~~~~~^~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |