結果
| 問題 | No.3286 Make a Happy Connection |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-04-10 12:42:58 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,600 bytes |
| 記録 | |
| コンパイル時間 | 2,784 ms |
| コンパイル使用メモリ | 335,164 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-10 12:43:02 |
| 合計ジャッジ時間 | 3,940 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
/////////////////////// COMMON //////////////////////
#include <bits/stdc++.h>
using namespace std;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define sb(n) __builtin_popcount(n)
#define endl '\n'
#define ll long long
#define ul unsigned long long
#define dl double
#define pub push_back
#define pob pop_back
#define len(a) (int)a.size()
#define fi first
#define se second
#define mpf(mp, k) mp.find(k) != mp.end()
#define mpnf(mp, k) mp.find(k) == mp.end()
#define lb(arr, tar) lower_bound(arr.begin(), arr.end(), tar) - arr.begin()
#define ub(arr, tar) upper_bound(arr.begin(), arr.end(), tar) - arr.begin()
#define pr(x, y) pair<x, y>
#define prdl(n) cout << fixed << setprecision(n)
#define ff(i, a, b, inc) for (int i = a; i <= b; i += inc)
#define fb(i, a, b, inc) for (int i = a; i >= b; i -= inc)
/////////////////////// WORLD //////////////////////
ll mod = 998244353;
template <typename T, typename... Args>
auto V(size_t n, Args... args)
{
if constexpr (sizeof...(args) == 1)
return vector<T>(n, args...);
else
return vector<decltype(V<T>(args...))>(n, V<T>(args...));
}
/////////////////////// OUTPUTS //////////////////////
template <typename... T>
void print(T... args)
{
((cout << args << " "), ...);
cout << endl;
}
template <typename T>
struct is_vector : std::false_type
{
};
template <typename T, typename Alloc>
struct is_vector<std::vector<T, Alloc>> : std::true_type
{
};
template <typename T>
void printV(const T &val)
{
std::cout << val;
}
template <typename T>
void printV(const vector<T> &v)
{
for (size_t i = 0; i < v.size(); ++i)
{
printV(v[i]);
if constexpr (!is_vector<T>::value)
{
if (i < v.size() - 1)
cout << " ";
}
}
if constexpr (!is_vector<T>::value)
{
cout << '\n';
}
}
void printG(auto &G)
{
int node = 0;
for (auto &it : G)
{
cout << node++ << " -> ";
printV(it);
cout << endl;
}
}
void printM(auto &M)
{
for (auto &it : M)
cout << it.fi << " -> " << it.se << endl;
}
//////////////////////////// main ///////////////////////
void solve()
{
int n;
cin >> n;
unordered_map<int, int> Mp;
ff(i, 0, n - 1, 1)
{
int a;
cin >> a;
if (Mp.find(a) != Mp.end() && i - Mp[a] <= 2)
{
print("Yes");
return;
}
Mp[a] = i;
}
print("No");
}
int main()
{
fio;
prdl(10);
solve();
return 0;
}
vjudge1