AcWing 4500. 三个元素
原题链接
简单
作者:
糖醋拐杖_8
,
2024-04-09 12:55:54
,
所有人可见
,
阅读 3
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#define x first
#define y second
using namespace std;
int n;
typedef long long LL;
typedef pair<LL, int> PII;
vector <PII> q;
set <LL> s;
int main()
{
cin >> n;
for (int i = 1;i <= n;i++)
{
LL t;
cin >> t;
if (!s.count(t))
{
s.insert(t);
q.push_back({t,i});
}
}
if (q.size() >= 3)
{
sort(q.begin(),q.end());
for (int i = 0;i < 3;i++) cout << q[i].y << " ";
puts("");
}
else
puts("-1 -1 -1");
return 0;
}