結果
| 問題 | No.490 yukiソート | 
| コンテスト | |
| ユーザー |  777yuuki12323 | 
| 提出日時 | 2017-03-10 22:49:19 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 9 ms / 2,000 ms | 
| コード長 | 698 bytes | 
| コンパイル時間 | 859 ms | 
| コンパイル使用メモリ | 55,676 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-24 10:13:24 | 
| 合計ジャッジ時間 | 2,193 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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( a[j] > a[i-j] && (i - j) < n){
        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;
}
            
            
            
        