結果
問題 |
No.360 増加門松列
|
ユーザー |
![]() |
提出日時 | 2025-02-03 13:23:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 820 ms |
コンパイル使用メモリ | 63,392 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-02-03 13:23:50 |
合計ジャッジ時間 | 1,922 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 15 |
ソースコード
#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; cin>>t; while(t--) solve(); return 0; }