結果
| 問題 |
No.490 yukiソート
|
| コンテスト | |
| ユーザー |
777yuuki12323
|
| 提出日時 | 2017-03-10 22:52:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 738 bytes |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 56,120 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 10:14:29 |
| 合計ジャッジ時間 | 1,799 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf("%d", a+i);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
typedef long long ll;
#define fi first
#define se second
int n;
int a[5123];
using namespace std;
int main(){
cin>>n;
int i;
int j;
int t;
for( i = 0; i < n; i++ ){
scanf("%d", a+i);
}
/*for( i = 0; i < n; i++ ){
printf("%d ", a[i] );
}
puts("");
*/
for( i = 1; i < (2*n - 3); i++ ){
for( j = 0; j < (i+1)/2; j++ ){
if( (i-j) < n && (i-j) > 0 ){
if( a[j] > a[i-j] ){
t = a[j];
a[j] = a[i-j];
a[i-j] = t;
}
}
}
}
for( i = 0; i < n; i++ ){
if( i )printf(" %d", a[i] );
else{ printf ("%d", a[i] );}
}
puts("");
return 0;
}
777yuuki12323