結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2022-05-27 15:56:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,510 bytes |
コンパイル時間 | 749 ms |
コンパイル使用メモリ | 92,576 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-20 15:16:17 |
合計ジャッジ時間 | 2,153 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
//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; }