結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-04-17 23:23:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 583 bytes |
| コンパイル時間 | 629 ms |
| コンパイル使用メモリ | 51,436 KB |
| 最終ジャッジ日時 | 2024-11-14 19:41:35 |
| 合計ジャッジ時間 | 1,188 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:5: error: ‘vector’ was not declared in this scope
12 | vector<int> a(7);
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:12:12: error: expected primary-expression before ‘int’
12 | vector<int> a(7);
| ^~~
main.cpp:13:17: error: ‘a’ was not declared in this scope
13 | for(int& v: a) cin>>v;
| ^
main.cpp:14:16: error: ‘a’ was not declared in this scope
14 | sort(begin(a), end(a));
| ^
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
bool iskadomatsu(int a, int b, int c)
{
return a!=c and ((b>a and b>c) or (b<a and b<c));
}
int main()
{
vector<int> a(7);
for(int& v: a) cin>>v;
sort(begin(a), end(a));
do {
bool ok=true;
for(int i=0; i<5; ++i) {
if (!(a[i]<a[i+2] and iskadomatsu(a[i], a[i+1], a[i+2]))) {
ok=false;
break;
}
}
if (ok) { cout<<"YES"<<endl; return 0; }
} while (next_permutation(begin(a), end(a)));
cout<<"NO"<<endl;
}
hogeover30