結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ramia777ramia777
提出日時 2022-05-27 15:56:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,510 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 91,348 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 19:43:17
合計ジャッジ時間 1,931 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 1 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 1 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 1 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 AC 1 ms
4,348 KB
testcase_48 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//Yukicoder
//Q204 GW2

//二次元可変配列
//vector <vector <int>> mass;
//vector <vector <int>> memo;

//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>//list
#include <set> //tree
#include <map> //連想配列
#include <unordered_set> //hash
#include <unordered_map> //hash
#include <algorithm>
#include <iomanip>
#include <cstring>

using namespace std;
typedef unsigned long long LL;


#define START (0)
#define RIGHT (1)
#define UP    (2)
#define LEFT  (3)
#define DOWN  (4)



#define DATA_MAX (1000000)

char a[60];
int  memo[60];
char _a[60];

int main()
{
	int N;
	int limit = 0;

	cin >> N;

	int j = 0;
	int i = 0;

	//前の2週間
	for (i = 0; i < 14; i++)
	{
		a[i] = 'x';
		memo[j] = i;
		j++;
	}

	for (i = 14; i < 28; i++)
	{
		cin >> a[i];
		if (a[i] == 'x')
		{
			memo[j] = i;
			j++;
		}
	}
	

	//後の2週間
	for (i = 28; i < 42; i++)
	{
		a[i] = 'x';
	}
	memo[j] = 28;

	memcpy(_a,a, 60);

	
	limit = j+1;
	j = 0;
	int max = 0;
	int ans = 0;

	while(1)
	{
		int flag = 0;
		for (int k=0;k<N;k++)
		{
			if (flag && a[memo[j]+k] == 'o')
				break;
			a[memo[j]+k] = 'o';
			flag = 1;	
		}

		/*
		//debug print
		for (i = 0; i < 42; i++)
		{
			cout <<a[i]<<",";

		}
		cout << endl;
	*/

		ans = 0;
		for (int k = 0; k < 42; k++)
		{
			if (a[k] == 'o')
				ans++;
			else
				ans = 0;

			if (ans > max)
				max = ans;
		}
		
		memcpy(a, _a, 60);
		
		j++;

		if (limit == j)
			break;

	}


	cout <<  max << endl;
	
	//getchar();
	return 0;
}

0