結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-11 16:16:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 861 bytes |
| コンパイル時間 | 2,008 ms |
| コンパイル使用メモリ | 196,416 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-11 16:17:00 |
| 合計ジャッジ時間 | 3,402 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:19: warning: unknown escape sequence: '\011'
17 | cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
| ^~~~~~~
main.cpp:17:36: warning: unknown escape sequence: '\011'
17 | cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
| ^~~~~~
main.cpp:26:23: warning: unknown escape sequence: '\011'
26 | cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
| ^~~~~~~~~~~
main.cpp:26:44: warning: unknown escape sequence: '\011'
26 | cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
| ^~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
int main(){
int n;cin>>n;
vector<int> a(n);
REP(i,n){
cin>>a[i];
}
int res=0;
int sub[3]={a[0],a[1],a[2]};
cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
if((sub[0]!=sub[2]) and ((sub[0]<sub[1] and sub[1]>sub[2]) or (sub[0]>sub[1] and sub[1]<sub[2]))){
cerr<<"Detected"<<endl;
res++;
}
REP(i,n-3){
sub[0]=sub[1];
sub[1]=sub[2];
sub[2]=a[3+i];
cerr<<sub[0]<<"\ "<<sub[1]<<"\ "<<sub[2]<<endl;
if((sub[0]!=sub[2]) and ((sub[0]<sub[1] and sub[1]>sub[2]) or (sub[0]>sub[1] and sub[1]<sub[2]))){
res++;
cerr<<"Detected"<<endl;
}
}
cout<<res<<"\
";
return 0;
}