結果
| 問題 |
No.2740 Old Maid
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-21 03:24:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 1,521 ms |
| コンパイル使用メモリ | 170,256 KB |
| 実行使用メモリ | 17,984 KB |
| 最終ジャッジ日時 | 2024-10-13 01:44:42 |
| 合計ジャッジ時間 | 8,712 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 61 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n = 0;
cin >> n;
vector<int> p(n);
vector<int> ans;
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.push_back(p.at(ind));
ans.push_back(p.at(ind+1));
p.erase(p.begin() + ind);
p.erase(p.begin() + ind);
}
for(int i=0;i<n-1;i++){
cout << ans.at(i) << ' ';
}
cout << ans.at(n-1) << endl;
}