結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-14 23:05:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 494 bytes |
| コンパイル時間 | 2,880 ms |
| コンパイル使用メモリ | 201,900 KB |
| 最終ジャッジ日時 | 2025-01-10 10:56:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | rep(i,7) scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
vector<int> a(7);
rep(i,7) scanf("%d",&a[i]);
sort(a.begin(),a.end());
do{
bool ok=true;
rep(i,5){
if(set<int>{a[i],a[i+1],a[i+2]}.size()!=3) ok=false;
if(max({a[i],a[i+1],a[i+2]})!=a[i+1]
&& min({a[i],a[i+1],a[i+2]})!=a[i+1]) ok=false;
if(a[i]>a[i+2]) ok=false;
}
if(ok) return puts("YES"),0;
}while(next_permutation(a.begin(),a.end()));
puts("NO");
return 0;
}