結果

問題 No.640 76本のトロンボーン
ユーザー chocoruskchocorusk
提出日時 2019-09-04 12:01:57
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,474 bytes
コンパイル時間 2,383 ms
コンパイル使用メモリ 101,660 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 01:44:28
合計ジャッジ時間 3,389 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:79:14: warning: left shift count >= width of type [-Wshift-count-overflow]
   if(i<<(1<<5)){
              ^
main.cpp:82:14: warning: left shift count >= width of type [-Wshift-count-overflow]
   if(i<<(1<<6)){
              ^
main.cpp:85:14: warning: left shift count >= width of type [-Wshift-count-overflow]
   if(i<<(1<<7)){
              ^
main.cpp:102:34: warning: left shift count >= width of type [-Wshift-count-overflow]
   if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
                                  ^
main.cpp:102:53: warning: left shift count >= width of type [-Wshift-count-overflow]
   if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
                                                     ^
main.cpp:102:72: warning: left shift count >= width of type [-Wshift-count-overflow]
   if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
                                                                        ^
main.cpp:106:21: warning: left shift count >= width of type [-Wshift-count-overflow]
   }else if((i<<(1<<6))==0 && ((i<<(1<<7)))==0){
                     ^
main.cpp:106:40: warning: left shift count >= width of type [-Wshift-count-overflow]
   }else if((i<<(1<<6))==0 && ((i<<(1<<7)))==0){
                                        ^
main.cpp:110:40: warning: left shift count >= width of type [-Wshift-count-overflow]
   }else if((i<<(1<<4))==0 && ((i<<(1<<5)))==0){
                                        ^

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
string s[77];
bool check(int p, int x, int y){
	if(p==0){
		if(y>=2) return false;
		for(int i=0; i<n-1; i++){
			if(s[x][y+i]=='#') return false;
		}
		return true;
	}else{
		if(x>=2) return false;
		for(int i=0; i<n-1; i++){
			if(s[x+i][y]=='#') return false;
		}
		return true;
	}
}
int main()
{
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>s[i];
	}
	int ans=0;
	for(int i=0; i<(1<<8); i++){
		bool dame=0;
		for(int j=0; j<4; j++){
			if(i&(1<<(2*j)) && i&(1<<(2*j+1))){
				dame=1; break;
			}
		}
		P nuee[4]={P(0, 4), P(1, 6), P(2, 5), P(3, 7)};
		for(int j=0; j<4; j++){
			if(i&(1<<nuee[j].first) && i&(1<<nuee[j].second)){
				dame=1; break;
			}
		}
		if(dame) continue;
		int cnt=0;
		if(i<<(1<<0)){
			if(check(0, 0, 0)) cnt++;
		}
		if(i<<(1<<1)){
			if(check(0, 0, 1)) cnt++;
		}
		if(i<<(1<<2)){
			if(check(0, n-1, 0)) cnt++;
		}
		if(i<<(1<<3)){
			if(check(0, n-1, 1)) cnt++;
		}
		if(i<<(1<<4)){
			if(check(1, 0, 0)) cnt++;
		}
		if(i<<(1<<5)){
			if(check(1, 1, 0)) cnt++;
		}
		if(i<<(1<<6)){
			if(check(1, 0, n-1)) cnt++;
		}
		if(i<<(1<<7)){
			if(check(1, 1, n-1)) cnt++;
		}
		int cnt1=0, cnt2=0;
		if((i<<(1<<0))==0 && ((i<<(1<<1)))==0 && (i<<(1<<2))==0 && ((i<<(1<<3)))==0){
			for(int j=1; j<n-1; j++){
				if(check(1, 0, j) || check(1, 1, j)) cnt1++;
			}
		}else if((i<<(1<<2))==0 && ((i<<(1<<3)))==0){
			for(int j=1; j<n-1; j++){
				if(check(1, 1, j)) cnt1++;
			}
		}else if((i<<(1<<0))==0 && ((i<<(1<<1)))==0){
			for(int j=1; j<n-1; j++){
				if(check(1, 0, j)) cnt1++;
			}
		}
		if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
			for(int j=1; j<n-1; j++){
				if(check(0, j, 0) || check(0, j, 1)) cnt2++;
			}
		}else if((i<<(1<<6))==0 && ((i<<(1<<7)))==0){
			for(int j=1; j<n-1; j++){
				if(check(0, j, 1)) cnt2++;
			}
		}else if((i<<(1<<4))==0 && ((i<<(1<<5)))==0){
			for(int j=1; j<n-1; j++){
				if(check(0, j, 0)) cnt2++;
			}
		}
		ans=max({ans, cnt+cnt1, cnt+cnt2});
	}
	cout<<ans<<endl;
	return 0;
}
0