提出 #53835829


ソースコード 拡げる

// #pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf (ll)1e18
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define lll __int128
const int N = 1e6 + 5;

void solve() {
	ll n, m;
	cin >> n >> m;
	vl a(n), b(m), c;
	set<ll> sa, sb;
	for (ll i = 0; i < n; i++)
		cin >> a[i], c.push_back(a[i]), sa.insert(a[i]);
	for (ll i = 0; i < m; i++)
		cin >> b[i], c.push_back(b[i]), sb.insert(b[i]);
	sort(c.begin(), c.end());
	for (ll i = 0; i < n + m - 1; i++) {
		if (sa.count(c[i]) && sa.count(c[i + 1])) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
	solve();
	return 0;
}

提出情報

提出日時
問題 B - Piano 2
ユーザ TopCloser
言語 C++ 20 (gcc 12.2)
得点 200
コード長 837 Byte
結果 AC
実行時間 1 ms
メモリ 3652 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 20
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 1 ms 3512 KiB
00_sample_02.txt AC 1 ms 3512 KiB
00_sample_03.txt AC 1 ms 3484 KiB
01_random_01.txt AC 1 ms 3504 KiB
01_random_02.txt AC 1 ms 3508 KiB
01_random_03.txt AC 1 ms 3504 KiB
01_random_04.txt AC 1 ms 3576 KiB
01_random_05.txt AC 1 ms 3576 KiB
01_random_06.txt AC 1 ms 3436 KiB
01_random_07.txt AC 1 ms 3576 KiB
01_random_08.txt AC 1 ms 3524 KiB
01_random_09.txt AC 1 ms 3384 KiB
01_random_10.txt AC 1 ms 3508 KiB
02_handmade_01.txt AC 1 ms 3332 KiB
02_handmade_02.txt AC 1 ms 3652 KiB
02_handmade_03.txt AC 1 ms 3500 KiB
02_handmade_04.txt AC 1 ms 3436 KiB
02_handmade_05.txt AC 1 ms 3508 KiB
02_handmade_06.txt AC 1 ms 3508 KiB
02_handmade_07.txt AC 1 ms 3380 KiB