結果
問題 | No.640 76本のトロンボーン |
ユーザー |
![]() |
提出日時 | 2018-01-26 23:18:52 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,214 bytes |
コンパイル時間 | 1,936 ms |
コンパイル使用メモリ | 160,528 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 17:21:08 |
合計ジャッジ時間 | 2,407 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
コンパイルメッセージ
main.cpp: In function ‘bool ok(long long int)’: main.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type] 54 | } | ^
ソースコード
#include <bits/stdc++.h>using namespace std;#define mp make_pair#define pb push_back#define all(x) (x).begin(),(x).end()#define YES() printf("YES\n")#define NO() printf("NO\n")#define Yes() printf("Yes\n")#define No() printf("No\n")#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w#define int long long//typedef long long ll;typedef vector<bool> vb;typedef vector<int> vi;typedef vector<vb> vvb;typedef vector<vi> vvi;typedef pair<int,int> P;template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }const int INF=1e+9;const double EPS=1e-9;const int MOD=1000000007;const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};string tmp[75];bool chk(int x1,int y1,int x2,int y2){for(int i = x1;i <= x2;i++){for(int j = y1;j <= y2;j++){if(tmp[i][j] == '#') return false;else tmp[i][j] = '#';}}return true;}int n;bool ok(int x){switch(x){case 0: return chk(0,0,n - 2,0);case 1: return chk(0,0,0,n - 2);case 2: return chk(1,0,n - 1,0);case 3: return chk(0,1,0,n - 1);case 4: return chk(n - 1,0,n - 1,n - 2);case 5: return chk(0,n - 1,n - 2,n - 1);case 6: return chk(n - 1,1,n - 1,n - 1);case 7: return chk(1,n - 1,n - 1,n - 1);}}signed main(){int ma = 0;string field[75];cin >> n;for(int i = 0;i < n;i++) cin >> field[i];for(int i = 0;i < (1 << 8);i++){int cnt = 0,t = 0;for(int i = 0;i < n;i++) tmp[i] = field[i];bool f = true;for(int j = 0;j < 8;j++){if((i >> j) & 1){t++;if(!ok(j)){f = false;break;}}}if(!f) continue;for(int j = 1;j < n - 1;j++){bool flag = true;for(int k = 1;k < n - 1;k++){if(tmp[j][k] == '#') flag = false;}if(flag && (tmp[j][0] == '.' || tmp[j][n - 1] == '.')) cnt++;}ma = max(ma,cnt + t);cnt = 0;for(int j = 1;j < n - 1;j++){bool flag = true;for(int k = 1;k < n - 1;k++){if(tmp[k][j] == '#') flag = false;}if(flag && (tmp[0][j] == '.' || tmp[n - 1][j] == '.')) cnt++;}ma = max(ma,cnt + t);}cout << ma << endl;return 0;}