結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-03 13:30:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 647 bytes |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 64,472 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-02-03 13:30:35 |
| 合計ジャッジ時間 | 1,889 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
bool check(int a,int b,int c) { return a<c&&((b<a&&b<c)||(b>a&&b>c)); }
void solve() {
int d[10],a[10];
for(int i=1;i<=7;i++) cin>>d[i],a[i]=i;
do {
bool flag=true;
for(int i=1;i<=5;i++) if(!check(d[a[i]],d[a[i+1]],d[a[i+2]])) { flag=false; break; }
if(flag) return puts("YES"),void();
}while(next_permutation(a+1,a+8));
puts("NO");
}
int main() {
//freopen("digit.in","r",stdin);
//freopen("digit.out","w",stdout);
ios::sync_with_stdio(false),cin.tie(nullptr);
int t=1;
while(t--) solve();
return 0;
}
vjudge1