結果

問題 No.360 増加門松列
ユーザー 0w1
提出日時 2016-11-25 23:28:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 2,044 ms
コンパイル使用メモリ 172,048 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 04:35:54
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const string msg[] = { "NO", "YES" };

int kado( int x, int y, int z ){
  if( x == y or y == z or z == x )
    return 0;  
  if( not ( min( { x, y, z } ) == y or max( { x, y, z } ) == y ) )
    return 0;
  return x < z;
}

signed main(){
  vector< int > D( 7 );
  for( int i = 0; i < 7; ++i )
    cin >> D[ i ];
  sort( D.begin(), D.end() );
  do{
    int ng = 0;
    for( int i = 0; i + 3 <= 7; ++i )
      ng |= not kado( D[ i ], D[ i + 1 ], D[ i + 2 ] );
    if( not ng )
      cout << msg[ 1 ] << endl, exit( 0 );
  } while( next_permutation( D.begin(), D.end() ) );
  cout << msg[ 0 ] << endl;
  return 0;
}
0