結果
問題 | No.640 76本のトロンボーン |
ユーザー | chocorusk |
提出日時 | 2019-09-04 12:01:57 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,474 bytes |
コンパイル時間 | 1,349 ms |
コンパイル使用メモリ | 104,112 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-07 21:00:41 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,944 KB |
コンパイルメッセージ
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; }