답안 #1042998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1042998 2024-08-03T17:20:21 Z ALeonidou 곤돌라 (IOI14_gondola) C++17
25 / 100
28 ms 6360 KB
#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()
#define ins insert

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;
    set <ll> st; st.ins(arr[0]);
    for (ll i=1; i<n; i++){
        if (arr[p] > arr[i]) p = i;
        if (st.find(arr[i]) == st.end()){
            st.ins(arr[i]);
        }
        else{
            return 0;
        }
    }

    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

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 440 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 9 ms 3032 KB Output is correct
7 Correct 5 ms 1264 KB Output is correct
8 Correct 16 ms 5552 KB Output is correct
9 Correct 5 ms 2008 KB Output is correct
10 Correct 20 ms 6152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 10 ms 3032 KB Output is correct
7 Correct 5 ms 1160 KB Output is correct
8 Correct 15 ms 5580 KB Output is correct
9 Correct 5 ms 2008 KB Output is correct
10 Correct 22 ms 6096 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 10 ms 3036 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 28 ms 6360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 352 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 352 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 0 ms 352 KB Output is correct
7 Incorrect 0 ms 352 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 352 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 356 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -