結果
| 問題 |
No.2089 置換の符号
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-12 21:15:58 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 397 bytes |
| コンパイル時間 | 772 ms |
| コンパイル使用メモリ | 66,844 KB |
| 最終ジャッジ日時 | 2025-02-09 10:35:50 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[10005];
for (int i = 0; i < n; i++)
{
cin >> a[i];
a[i]--;
}
int c = 0;
int b[10005]{0};
for (int i = 0; i < n; i++)
{
for (int j = a[i]; j < n; j++)
{
c += b[j];
}
b[a[i]]++;
}
cout << 1 - c % 2 * 2 << endl;
}