結果
| 問題 | No.640 76本のトロンボーン |
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2019-09-04 12:01:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,474 bytes |
| 記録 | |
| コンパイル時間 | 1,868 ms |
| コンパイル使用メモリ | 103,432 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 06:17:18 |
| 合計ジャッジ時間 | 1,981 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:79:21: warning: left shift count >= width of type [-Wshift-count-overflow]
79 | if(i<<(1<<5)){
| ~^~~~~~~~
main.cpp:82:21: warning: left shift count >= width of type [-Wshift-count-overflow]
82 | if(i<<(1<<6)){
| ~^~~~~~~~
main.cpp:85:21: warning: left shift count >= width of type [-Wshift-count-overflow]
85 | if(i<<(1<<7)){
| ~^~~~~~~~
main.cpp:102:41: warning: left shift count >= width of type [-Wshift-count-overflow]
102 | if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
| ~^~~~~~~~
main.cpp:102:60: warning: left shift count >= width of type [-Wshift-count-overflow]
102 | if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
| ~^~~~~~~~
main.cpp:102:79: warning: left shift count >= width of type [-Wshift-count-overflow]
102 | if((i<<(1<<4))==0 && ((i<<(1<<5)))==0 && (i<<(1<<6))==0 && ((i<<(1<<7)))==0){
| ~^~~~~~~~
main.cpp:106:28: warning: left shift count >= width of type [-Wshift-count-overflow]
106 | }else if((i<<(1<<6))==0 && ((i<<(1<<7)))==0){
| ~^~~~~~~~
main.cpp:106:47: warning: left shift count >= width of type [-Wshift-count-overflow]
106 | }else if((i<<(1<<6))==0 && ((i<<(1<<7)))==0){
| ~^~~~~~~~
main.cpp:110:47: warning: left shift count >= width of type [-Wshift-count-overflow]
110 | }else if((i<<(1<<4))==0 && ((i<<(1<<5)))==0){
| ~^~~~~~~~
ソースコード
#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;
}
chocorusk