結果
| 問題 |
No.2815 Smaller than all
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-18 01:04:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 663 bytes |
| コンパイル時間 | 1,991 ms |
| コンパイル使用メモリ | 198,008 KB |
| 最終ジャッジ日時 | 2025-02-23 16:07:24 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 22 |
ソースコード
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
int main() {
ll N;
cin >> N;
vector<ll> A(N);
rep(i,N) cin >> A[i];
ll ans=0;
rep(i,N){
if(A[i]!=A[0]) break;
ans++;
}
for(ll i=N-1;i>=0;i--){
if(A[i]!=A[N-1]) break;
ans++;
}
if(ans==N*2) ans=N+1;
cout << ans-1 << endl;
return 0;
}