結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー koba-e964
提出日時 2015-07-05 19:58:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 506 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 158,564 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 11:47:42
合計ジャッジ時間 2,840 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int solve(ll a) {
  int m = 0;
  while(a > 0) {
  ll l = a&-a;
    ll b=a&~(a+l);
m=max(m,__builtin_popcountll(b));
a^=b;
  }
return m;
}
int main(){
ll b = 0;
int d;cin>>d;
rep(i,2) {
 string s;cin>>s;
 rep(j, 7) {
  b |= s[j] == 'o' ? 1 << (i * 7 + j) : 0;
 }
}
b <<= 14;
int m=0;
rep(i, 29){
rep(j,d+1) {
ll q=((1LL<<j)-1LL)<<i;
if(b&q)continue;
m=max(m, solve(b | q));
}
}
cout<<m<<endl;
}
0