結果

問題 No.1219 Mancala Combo
ユーザー CyanmondCyanmond
提出日時 2020-09-04 22:23:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,548 bytes
コンパイル時間 1,377 ms
コンパイル使用メモリ 129,680 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-05-04 23:37:57
合計ジャッジ時間 2,580 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 44 ms
5,888 KB
testcase_18 WA -
testcase_19 AC 38 ms
5,632 KB
testcase_20 WA -
testcase_21 AC 35 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 55 ms
6,400 KB
testcase_24 WA -
testcase_25 AC 38 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 64 ms
6,784 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#pragma endregion
#pragma endregion

int main() {
	int n; cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) cin >> d[i];
	bool s = false;
	if (d[0] != 0) s = true;
	for (int i = 1; i < n; i++) {
		if (d[i] != 0) s = false;
	}
	if (s) {
		cout << "Yes" << endl; 
		return 0;
	}
	map<int, int> mp;
	for (int i = 1; i < n; i++) {
		mp[(i + 1) - d[i]]++;
	}
	bool h = false;
	bool cnt = false;
	if (mp[0] == 0) {
		cout << "No" << endl;
		return 0;
	}
	if (mp[2] > 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 1; i < n; i++) {
		if (mp[i] == 0) {
			cnt = true;
		}
		if (mp[i] == 1) {
			if (cnt) {
				cout << "No" << endl;
				return 0;
			}
		}
		if (mp[i] > 1) {
			cout << "No" << endl; 
			return 0;
		}
	}
	if (cnt) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}
0