結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
mag
|
| 提出日時 | 2020-06-14 12:49:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 510 bytes |
| コンパイル時間 | 1,778 ms |
| コンパイル使用メモリ | 170,816 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 05:22:16 |
| 合計ジャッジ時間 | 2,670 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
int main(){
cin.tie(nullptr);ios_base::sync_with_stdio(false);
int n;cin>>n;
vector<int> a(n);rep(i,n)cin>>a[i];
int cnt=0,hoge;
rep(i,n-2){
hoge=a[i];
vector<int> b(3);
rep(j,3)b[j]=a[i+j];
sort(b.begin(),b.end());
//rep(j,b.size())cout<<b[j]<<" ";
//cout<<endl;
if(hoge==b[0]||hoge==b[2])cnt++;
}
cout<<cnt<<endl;
}
mag