結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-15 21:50:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 603 ms |
| コンパイル使用メモリ | 71,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 09:28:40 |
| 合計ジャッジ時間 | 1,888 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 3 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int N;
bool ex[1<<17];
main()
{
cin>>N;
vector<pair<int,int> >A;
int pre;
bool out=false;
for(int i=0;i<N;i++)
{
int a;cin>>a;
if(i==0||pre!=a)
{
A.push_back(make_pair(a,1));
pre=a;
if(ex[a])
{
out=true;
}
ex[a]=true;
}
else A.back().second++;
}
if(!out)cout<<0<<endl;
else cout<<(A.size()==3?1:-1)<<endl;
}