結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-03-12 01:01:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 1,718 ms |
コンパイル使用メモリ | 169,352 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-06-24 14:17:59 |
合計ジャッジ時間 | 5,621 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 3 TLE * 1 -- * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++) #define ALL(x) x.begin(),x.end() template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; } template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; } typedef long long ll; ll N,K; int main() { scanf("%lld%lld",&N,&K); vector<int> A(N + 1); FOR(i,1,N + 1){ scanf("%d",&A [i]); } ll t = 0; FOR(i,1,N + 1){ for(int j = i;j > 0;j--) if(A [j] < A [j - 1]){ swap(A [j],A [j - 1]); t++; } } if(t <= K && (K - t) % 2 == 0){ printf("YES\n"); } else{ printf("NO\n"); } return 0; }