이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define sz(x) (ll)x.size()
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
void printVct(vi &v){
for (ll i =0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
//subtask 1 & 2
int valid(int n, int arr[]){
ll p = 0;
for (ll i=1; i<n; i++){
if (arr[p] > arr[i]) p = i;
}
if (arr[p] > n) return 1;
vi v;
for (ll i = p; i<n; i++){
if (arr[i] <= n) v.pb(arr[i]);
else v.pb(v.back()+1);
}
for (ll i =0; i<p; i++){
if (arr[i] <= n) v.pb(arr[i]);
else v.pb(v.back()+1);
}
for (ll i =1; i<n; i++){
if (v[i] != v[i-1] + 1){
return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int arr[], int ans[])
{
sort(arr, arr+n);
ll ans_size = 0;
ll c = 1;
for (ll i=0; i<n; i++){
while (arr[i] > c){
ans[ans_size] = c;
ans_size++;
c++;
}
c++;
}
return ans_size;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
/*
1
5
1 2 3 4 5
*/
# | 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... |