結果

問題 No.2740 Old Maid
ユーザー Alc5_Alc5_
提出日時 2024-04-21 03:36:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 590 bytes
コンパイル時間 1,468 ms
コンパイル使用メモリ 168,496 KB
実行使用メモリ 15,232 KB
最終ジャッジ日時 2024-10-13 01:57:12
合計ジャッジ時間 8,660 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n = 0;
    cin >> n;
    vector<int> p(n);
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        cin >> p.at(i);
    }

    for(int i=0;i<n/2;i++){
        int tmp = n+1;
        int ind = 0;
        for(int j=0;j<p.size()-1;j++){
            if(p.at(j)<tmp){
                tmp = p.at(j);
                ind = j;
            }
        }
        ans.at(2*i) = p.at(ind);
        ans.at(2*i+1) = p.at(ind+1);
    }

    for(int i=0;i<n-1;i++){
        cout << ans.at(i) << ' ';
    }
    cout << ans.at(n-1) << endl;
}
0