結果
| 問題 |
No.1604 Swap Sort:ONE
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2021-07-17 02:28:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 578 bytes |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 95,880 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 13:38:47 |
| 合計ジャッジ時間 | 2,183 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
const long long MOD = (long long)(1e9) + 7;
int main() {
//cout << fixed << setprecision(15);
int n;
cin >> n;
vector<int> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i];
}
int ans =0;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (p[i] > p[j]) {
ans++;
swap(p[i] , p[j]);
}
}
}
cout << ans << endl;
return 0;
}
mmn15277198