結果
問題 | No.411 昇順昇順ソート |
ユーザー |
|
提出日時 | 2018-07-12 22:30:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 72,064 KB |
実行使用メモリ | 13,636 KB |
最終ジャッジ日時 | 2024-10-04 10:41:18 |
合計ジャッジ時間 | 4,579 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 2 WA * 21 TLE * 1 -- * 6 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(int argc, char* argv[]) { int N,K,i; cin>>N>>K; vector<int> V(N); for (i=0;i<N;i++){ V[i]=i+1; } int ans=0; do{ if (V[0]==K){ int num=0; for (i=0;i<N-1;i++){ if (V[i]>V[+1]){ num++; if (num>=2){ break; } } } if (num==1){ ans++; } } }while(next_permutation(V.begin(),V.end())); cout<<ans<<endl; return 0; }