結果
問題 | No.402 最も海から遠い場所 |
ユーザー | Yut176 |
提出日時 | 2016-07-23 00:15:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,804 bytes |
コンパイル時間 | 674 ms |
コンパイル使用メモリ | 68,132 KB |
実行使用メモリ | 73,508 KB |
最終ジャッジ日時 | 2024-04-24 06:52:47 |
合計ジャッジ時間 | 6,301 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | WA | - |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | WA | - |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | WA | - |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
ソースコード
#include<iostream> #include<algorithm> #include<stdio.h> #include<stdlib.h> #include<vector> #include<string> #include<sstream> using namespace std; int main(){ int h,w; cin >> h >> w; vector<string> s(h); for(int i=0;i<h;i++){ cin >> s[i]; } vector< vector<int> > a(h+2,vector<int>(w+2)); // vector< vector<int> > b(h+2,vector<int>(w+2)); for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if( s[i][j] == '#' ){ a[i+1][j+1] = 1; }else{ a[i+1][j+1] = 0; } } } int ans = -1; for(int i=1;i<h+1;i++){ for(int j=1;j<w+1;j++){ if( a[i][j] == 0 ) continue; int dx[4] = {1,0, 0,-1}; int dy[4] = {0,1,-1, 0}; int tmp=10000; for(int k=0;k<4;k++){ int mx = i + dx[k]; int my = i + dy[k]; int cnt = 0; while( true ){ cnt++; if( a[mx][my] == 0 ) break; mx += dx[k]; my += dy[k]; } if( tmp > cnt ) tmp = cnt; } if( ans < tmp ) ans = tmp; } } cout << ans << endl; // b=a; // // int dx[9] = {1,1, 1,0, 0,-1,-1,-1}; // int dy[9] = {1,0,-1,1,-1, 1, 0,-1}; // int cnt=1; // // while( cnt < max(h+2,w+2)/2 ){ // // for(int x=0;x<h+2;x++){ // for(int y=0;y<w+2;y++){ // // if( a[x][y] != 10000 ) continue; // // for(int i=0;i<8;i++){ // if( a[x+dx[i]][y+dy[i]] == cnt-1 ){ // b[x][y] = cnt; // break; // } // } // // } // } // cnt++; // a = b; // // } // // int ans=0; // for(int i=1;i<h+1;i++){ // for(int j=1;j<w+1;j++){ // // printf("%d",a[i][j]); // if(ans < a[i][j]) ans = a[i][j]; // } // // printf("\n"); // } // cout << ans << endl; return 0; }