結果
問題 |
No.490 yukiソート
|
ユーザー |
![]() |
提出日時 | 2017-03-10 22:33:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 614 ms |
コンパイル使用メモリ | 57,912 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-06-24 10:02:10 |
合計ジャッジ時間 | 4,582 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 3 WA * 11 TLE * 1 -- * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | REP(i,n) scanf("%lld", &a[i]); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) typedef long long ll; ll a[5001]; int main(){ int n; cin >> n; REP(i,n) scanf("%lld", &a[i]); FOR(i,1,2*n-3){ REP(p,n){ REP(q,n){ if (p+q == i){ if (a[p] > a[q]){ int tmp = a[p]; a[p] = a[q]; a[q] = a[p]; } } } } } REP(i,n){ printf("%lld", a[i]); if (i != n-1) printf(" "); else puts(""); } return 0; }