結果
| 問題 |
No.2779 Don't make Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-08 06:50:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 764 bytes |
| コンパイル時間 | 9,388 ms |
| コンパイル使用メモリ | 336,108 KB |
| 実行使用メモリ | 14,720 KB |
| 最終ジャッジ日時 | 2024-12-27 04:15:21 |
| 合計ジャッジ時間 | 11,271 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 20 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using mint = modint998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
int n;
int main(){
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a[i];
map<int,vector<int>>mp;
rep(i,n) mp[a[i]].push_back(i);
int l=0;
int r=n-1;
for(auto p:mp){
if(p.second.size()>2){
cout << 0 << endl;
return 0;
}
if(p.second.size()==2){
l=max(l,p.second[0]);
r=min(r,p.second[1]);
}
}
cout << max(0,r-l) << endl;
for(int i=l;i<r;i++) cout << i+1 << " ";
cout<<endl;
return 0;
}