이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifndef WAIMAI
#include "gondola.h"
#endif
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout (T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
int valid(int n, int a[]) {
int shift = -1;
for (int i = 0; i < n; i++) if (a[i] <= n) {
if (shift == -1) shift = (a[i] - 1 - i + n) % n;
else if ((a[i] - 1 - i + n) % n != shift) return 0;
}
return 1;
}
int replacement(int n, int a[], int b[]) {
}
const int MOD = 1e9 + 9;
int countReplacement(int n, int a[]) {
}
#ifdef WAIMAI
int gondolaSequence[100001];
int replacementSequence[250001];
int main() {
int i, n, tag;
int nr;
assert (scanf ("%d", &tag) == 1);
assert (scanf ("%d", &n) == 1);
for (i = 0; i < n; i++)
assert ( scanf ("%d", &gondolaSequence[i]) == 1);
switch (tag) {
case 1:
case 2:
case 3:
printf ("%d\n", valid (n, gondolaSequence) );
break;
case 4:
case 5:
case 6:
nr = replacement (n, gondolaSequence, replacementSequence);
printf ("%d ", nr);
if (nr > 0) {
for (i = 0; i < nr - 1; i++)
printf ("%d ", replacementSequence[i]);
printf ("%d\n", replacementSequence[nr - 1]);
} else printf ("\n");
break;
case 7:
case 8:
case 9:
case 10:
printf ("%d\n", countReplacement (n, gondolaSequence) );
break;
}
return 0;
}
#endif
컴파일 시 표준 에러 (stderr) 메시지
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
37 | }
| ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
42 | }
| ^
# | 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... |