結果
| 問題 |
No.411 昇順昇順ソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-12 22:34:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 459 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 72,240 KB |
| 実行使用メモリ | 10,020 KB |
| 最終ジャッジ日時 | 2024-10-04 10:55:39 |
| 合計ジャッジ時間 | 4,619 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 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[i+1]){
num++;
if (num>=2){
break;
}
}
}
if (num==1){
ans++;
}
}
}while(next_permutation(V.begin(),V.end()));
cout<<ans<<endl;
return 0;
}