結果
問題 | No.490 yukiソート |
ユーザー | tkmst201 |
提出日時 | 2017-03-10 22:25:22 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 1,147 bytes |
コンパイル時間 | 603 ms |
コンパイル使用メモリ | 81,240 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 09:55:38 |
合計ジャッジ時間 | 1,734 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | REP(i, n) scanf("%d", a + i); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <queue> #include <map> #include <set> #include <functional> #include <cmath> #include <complex> #include <cctype> #include <cassert> #include <sstream> #include <ctime> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; } template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<int, pii> P; #define INF (1<<29) #define INFL (1ll<<60) #define EPS (1e-8) #define PI (acos(-1)) const ll MOD = 1000000007ll; int main() { int n; int a[5000]; cin >> n; REP(i, n) scanf("%d", a + i); FOR(i, 1, 2 * n - 3) { for (int p = 0; p <= n - 1; p++) { int q = i - p; if (q < 0 || q > n - 1) continue; if (a[p] < a[q]) swap(a[p], a[q]); } } REP(i, n) printf("%d%c", a[i], i == n - 1 ? '\n' : ' '); return 0; }