結果

問題 No.1219 Mancala Combo
ユーザー ldsyb
提出日時 2020-09-04 22:11:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 552 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 195,348 KB
最終ジャッジ日時 2025-01-14 05:51:04
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> as(n + 1, 0);
	for (int64_t i = 1; i <= n; i++)
	{
		cin >> as[i];
	}

	int64_t sum = accumulate(as.begin(), as.end(), int64_t(0));

	while (as[0] != sum)
	{
		bool f = true;
		for (int64_t i = 1; i <= n; i++)
		{
			if (as[i] == i)
			{
				f = false;
				as[i] = 0;
				for (int64_t j = i - 1; 0 <= j; j--)
				{
					as[j]++;
				}
				break;
			}
		}

		if (f)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}
0