結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2019-12-24 07:49:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 464 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 65,548 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 18:17:00 |
合計ジャッジ時間 | 1,845 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <iostream>using namespace std;int main() {int n;cin >> n;int arr[n];for (int i=0; i<n; i++) {cin >> arr[i];}int tmp;for (int i=0; i<n; i++) {for (int j=i+1; j<n; j++) {if (arr[i]>arr[j] && i+j<2*n-3) {tmp=arr[i];arr[i]=arr[j];arr[j]=tmp;}}}for (int i=0; i<n; i++) {if (i<n-1) {cout << arr[i] << " ";} else {cout << arr[i] << endl;}}}