結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2018-01-06 23:30:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 619 ms |
| コンパイル使用メモリ | 73,872 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 09:15:40 |
| 合計ジャッジ時間 | 2,524 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 28 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <cctype>
#include <stdio.h>
using namespace std;
int main() {
int n = 0, k = 0;
cin >> n >> k;
int tmp = 0;
int ct = 0;
for (int i = 1; i < n + 1; i++) {
cin >> tmp;
if (tmp != i) {
ct++;
}
}
cout<<ct;
if((ct / 2) > k){
cout << "NO" << endl;
return 0;
}
/* if (ct % 2 == 0) {*/
if ((ct / 2) % 2 == k % 2 && k<ct/2) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
/*}else if (ct %2 ==1) {
if (((ct-1)) % 2 == k % 2) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}*/
return 0;
}
newlife171128