This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N;
ll A[35];
ll B[35];
int main() {
cin.tie(0) -> sync_with_stdio(false);
cin >> N;
cin >> A[1];
ll P = 0, V = 0;
V = A[1];
B[P] = A[1];
for(int i = 1; i < N; i++)
{
P += V;
P %= N;
while(B[P])
{
P++;
P %= N;
}
cin >> A[i];
B[P] = V = A[i];
}
cout << N << '\n';
for(int i = 0; i < N; i++) cout << B[i] << ' ';
}
# | 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... |