제출 #1360537

#제출 시각아이디문제언어결과실행 시간메모리
1360537lizi14곤돌라 (IOI14_gondola)C++20
20 / 100
26 ms5200 KiB
#include <bits/stdc++.h>
using namespace std;
#include "gondola.h"
// int inputSeq[10000];
// int replacementSeq[10000];
// int gondolaSeq[10000];
int valid(int n, int inputSeq[]){
    
    vector<pair<int,int>>v;
    set<int>s;
    for(int i=0; i<n; i++){
        if(inputSeq[i]<=n)v.push_back({inputSeq[i],i});
        if(s.find(inputSeq[i])!=s.end()){
            return false;
        }
        s.insert(inputSeq[i]);
    }
    for(int i=1; i<n; i++){
        //if(v[i-1]==1)continue;
        if(v[i].first==1){
            continue;
        }
        
        if(v[i].first-v[i-1].first==v[i].second-v[i-1].second)continue;
        return false;
    }
    return true;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
    if(valid(n,gondolaSeq)==false){
        return 0;
    }
    else{
        vector<int>bati;
        map<int,int>mp;
        for(int i=0; i<n; i++){
            mp[gondolaSeq[i]]++;
        }
        for(int i=1; i<=n; i++){
            if(mp[i]==0)bati.push_back(i);
        }
        int k=0;
        for(auto a:bati){
            replacementSeq[k]=a;
            k++;
        }
        return bati.size();
    }
    //return 0;
}

int countReplacement(int n, int inputSeq[]){
    return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…