結果
| 問題 |
No.334 門松ゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-01-16 00:29:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| コンパイル時間 | 648 ms |
| コンパイル使用メモリ | 75,048 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 19:43:21 |
| 合計ジャッジ時間 | 1,257 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 13 |
ソースコード
#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;
}
}
}
}