結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
define
|
| 提出日時 | 2020-05-15 22:15:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 870 bytes |
| コンパイル時間 | 2,268 ms |
| コンパイル使用メモリ | 198,156 KB |
| 最終ジャッジ日時 | 2025-01-10 11:43:15 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 5 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back
template<class T> inline bool chmin(T &a, T b){
if(a>b){a=b;return true;}
return false;
}
template<class T> inline bool chmax(T &a, T b){
if(a<b){a=b;return true;}
return false;
}
constexpr int mod = 998244353;
constexpr int inf = 3e18;
int N,A[200005];
signed main(){
cin.tie(0);ios::sync_with_stdio(false);
cin>>N;
rep(i,N)cin>>A[i];
set<int>st;
int i=0;
bool flag=false;
while(i<N){
int j=i;
while(j<N&&A[i]==A[j])j++;
if(flag&&st.find(A[i])!=st.end()){
cout<<-1<<endl;return 0;
}else if(st.find(A[i])!=st.end()){
flag=true;
}else {
st.insert(A[i]);
}
i=j;
}
cout<<flag<<endl;
}
define