結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
Ryu
|
| 提出日時 | 2018-01-04 00:30:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 678 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 71,936 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-12-23 02:36:26 |
| 合計ジャッジ時間 | 47,317 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 2 TLE * 15 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long int;
int main()
{
ll N, K, cnt = 0;
cin >> N >> K;
vector<ll> vec(N, 0);
for(int i = 0; i < N; i++)
{
cin >> vec[i];
}
bool isEnd = false;
while(!isEnd)
{
bool loopSwap = false;
for(int i = 0; i < N - 1; i++)
{
if(vec[i] > vec[i + 1])
{
swap(vec[i], vec[i + 1]);
loopSwap = true;
cnt++;
}
}
if(!loopSwap)
isEnd = true;
}
cout << ((K - cnt) % 2 == 0 ? "YES" : "NO") << endl;
}
Ryu