結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2017-03-11 21:07:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 1,207 ms |
コンパイル使用メモリ | 158,772 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 13:09:47 |
合計ジャッジ時間 | 3,933 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 RE * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:20:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | rep(i, N) scanf("%d", &a[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i, j, k) for(int i = j; i < k; ++i)#define rep(i, j) FOR(i, 0, j)#define repr(i, j) for(int i = j; i >= 0; --i)#define INF (1 << 30)#define MOD 1e9 + 7typedef long long ll;typedef unsigned long long ull;typedef pair<int, int> P;int N;int a[2000];int main() {scanf("%d", &N);rep(i, N) scanf("%d", &a[i]);rep(i, 2 * N - 3) {rep(p, N) {if(i - p < 0 || a[p] == 0 || a[i - p] == 0) continue;if(a[p] < a[i - p]) swap(a[p], a[i - p]);}}rep(i, N) {if(i != N - 1) printf("%d ", a[i]);else printf("%d\n", a[i]);}return 0;}