結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
sorag
|
| 提出日時 | 2022-08-17 12:45:19 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 649 bytes |
| コンパイル時間 | 841 ms |
| コンパイル使用メモリ | 100,056 KB |
| 最終ジャッジ日時 | 2024-11-15 02:29:22 |
| 合計ジャッジ時間 | 1,255 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
24 | sort(all(b));
| ^~~~
| sqrt
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define pb push_back
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
int cnt=0;
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n-2;i++){
int b[]={a[i],a[i+1],a[i+2]};
sort(all(b));
if(b[0]!=b[1] and b[1]!=b[2] and b[2]!=b[0]){
if(b[0]==a[i+1] or b[2]==a[i+1]) cnt++;
}
}
cout<<cnt<<endl;
return 0;
}
sorag