提出 #41347092


ソースコード 拡げる

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define test int T; cin >> T; while(T--)
using namespace std;
using lnt = long long;

int main(){
    cin.tie(nullptr), ios::sync_with_stdio(false);

    int n, a[107];
    vector<int> v;
    cin >> n;
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++){
        v.emplace_back(a[i]);
        if(abs(a[i] - a[i+1]) == 1 || i == n) continue;
        if(a[i] < a[i+1]){
            for(int j=a[i]+1; j<a[i+1]; j++) v.emplace_back(j);
        }
        else for(int j=a[i]-1; j>a[i+1]; j--) v.emplace_back(j);
    }
    for(auto x: v) cout << x << " ";
}

提出情報

提出日時
問題 B - Fill the Gaps
ユーザ pluie
言語 C++ (GCC 9.2.1)
得点 200
コード長 655 Byte
結果 AC
実行時間 8 ms
メモリ 3704 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 10
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 8 ms 3520 KiB
random_02.txt AC 2 ms 3528 KiB
random_03.txt AC 2 ms 3568 KiB
random_04.txt AC 2 ms 3484 KiB
random_05.txt AC 2 ms 3600 KiB
random_06.txt AC 3 ms 3704 KiB
random_07.txt AC 2 ms 3448 KiB
random_08.txt AC 2 ms 3564 KiB
sample_01.txt AC 2 ms 3592 KiB
sample_02.txt AC 2 ms 3444 KiB