結果

問題 No.2997 Making YuzuKizu
ユーザー elphe
提出日時 2024-12-27 20:03:49
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 949 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 20:03:53
合計ジャッジ時間 2,486 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:50:95: warning: 'count[6]' may be used uninitialized [-Wmaybe-uninitialized]
   50 |                                 << min({ count[1], count[2], count[4] / 3, count[5], count[6] / 2 }) << '\n';
      |                                                                                      ~~~~~~~~~^~~
main.cpp:15:17: note: 'count[6]' was declared here
   15 |         int32_t count[7];
      |                 ^~~~~
main.cpp:15:17: warning: 'count[5]' may be used uninitialized [-Wmaybe-uninitialized]
main.cpp:50:71: warning: 'count[4]' may be used uninitialized [-Wmaybe-uninitialized]
   50 |                                 << min({ count[1], count[2], count[4] / 3, count[5], count[6] / 2 }) << '\n';
      |                                                              ~~~~~~~~~^~~
main.cpp:15:17: note: 'count[4]' was declared here
   15 |         int32_t count[7];
      |                 ^~~~~
main.cpp:15:17: warning: 'count[3]' may be used uninitialized [-Wmaybe-uninitialized]
main.cpp:15:17: warning: 'count[2]' may be used uninitialized [-Wmaybe-uninitialized]
main.cpp:15:17: warning: 'count[1]' may be used uninitialized [-Wmaybe-uninitialized]
main.cpp:49:51: warning: 'count[0]' may be used uninitialized [-Wmaybe-uninitialized]
   49 |                                 << min({ count[0] / 2, count[1], count[2], count[3] }) << ' '
      |                                          ~~~~~~~~~^~~
main.cpp:15:17: note: 'count[0]' was declared here
   15 |         int32_t count[7];
      |                 ^~~~~

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <algorithm>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	char S[1000001];
	cin >> S;

	int32_t count[7];
	for (int32_t i = 0; ; ++i)
		switch(S[i])
		{
		case 'a':
			++count[0];
			break;

		case 'i':
			++count[1];
			break;

		case 'k':
			++count[2];
			break;

		case 'r':
			++count[3];
			break;

		case 'u':
			++count[4];
			break;

		case 'y':
			++count[5];
			break;

		case 'z':
			++count[6];
			break;

		case '\0':
			cout << min({ count[0], count[1], count[2], count[3], count[4], count[5] }) << ' '
				<< min({ count[0] / 2, count[1], count[2], count[3] }) << ' '
				<< min({ count[1], count[2], count[4] / 3, count[5], count[6] / 2 }) << '\n';
			return 0;
		}

	return -1;
}
0