結果

問題 No.334 門松ゲーム
ユーザー mio_hmio_h
提出日時 2016-01-16 00:29:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,056 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 75,232 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 23:50:21
合計ジャッジ時間 1,281 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;
const int INF = 100000000;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int k[21];
int dp[21];
vector <int> s;
int main(){
    int n, lis=-1;
    int mlis = -1;
    cin >> n;
    rep(i,n) cin >> k[i];
    rep(i,n) {
        dp[i] = 1;
        rep(j,i){
            if(k[j] < k[i]){
                dp[i] = max(dp[i], dp[j]+1);
                s.push_back(i);
            }
        }
        lis = max(lis,dp[i]);
    }
    int a = (n-lis) /3;
    if(a%2==0 && a>= 3){
        cout << "-1" <<endl;
        return 0;
    }
    int f = n-lis;
    rep(i,n-2) {
        for(int j=i+1;j<n-1;j++){
            for(int h=j+1;h<n;h++){
                if(k[i] < k[j] && k[j] < k[h]) break;
                if(k[i] > k[j] && k[j] > k[h]) break;
                cout << i << " "<< j << " " << k << endl;
                return 0;
            }
        }
    }
}
0