結果

問題 No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn
ユーザー cn_449cn_449
提出日時 2020-04-01 22:12:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,881 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 97,384 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 18:32:08
合計ジャッジ時間 1,823 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:76:60: 警告: ‘d’ may be used uninitialized [-Wmaybe-uninitialized]
   76 |                 if (cnt2[i] == 1 && cnt[i] == 0 && check&& d - 'a' != i) {
      |                                                            ^
main.cpp:49:14: 備考: ‘d’ はここで定義されています
   49 |         char d;
      |              ^

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	vector<int> cnt(26);
	vector<int> cnt2(26);
	string s;
	int check = 0;
	char d;
	while (cin >> s) {
		for (char c : s) {
			if (check == 0) cnt[c - 'a']++;
			else cnt2[c - 'a']++;
			check ^= 1;
			d = c;
		}
		check ^= 1;
	}
	rep(i, 26) {
		if (cnt[i] > 1 && cnt2[i] == 0 || cnt[i] == 0 && cnt2[i] > 1) {
			cout << "Yes" << endl;
			return 0;
		}
		if (cnt[i] == 1 && cnt2[i] == 0 && check) {
			cout << "Yes" << endl;
			return 0;
		}
		if (cnt[i] == 1 && cnt2[i] == 0 && !check&& d - 'a' != i) {
			cout << "Yes" << endl;
			return 0;
		}
		if (cnt2[i] == 1 && cnt[i] == 0 && !check) {
			cout << "Yes" << endl;
			return 0;
		}
		if (cnt2[i] == 1 && cnt[i] == 0 && check&& d - 'a' != i) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}
0