結果
問題 |
No.402 最も海から遠い場所
|
ユーザー |
|
提出日時 | 2017-09-08 23:38:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 118 ms / 3,000 ms |
コード長 | 1,243 bytes |
コンパイル時間 | 2,084 ms |
コンパイル使用メモリ | 192,420 KB |
最終ジャッジ日時 | 2025-01-05 02:50:36 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%s",maze[i]);//gets(maze[i]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl; #define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;} #define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl; #define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;} #define ALL(v) (v).begin(),(v).end() #define BIGINT 0x7FFFFFFF #define E107 1000000007 template<typename T1,typename T2> ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;} int h,w; char maze[5000][5000]; int dp[5005][5005]; int main(){ int i,j,k,l; int maxi=0; cin>>h>>w;cin.ignore(); for (i=1;i<=h;i++){ scanf("%s",maze[i]);//gets(maze[i]); for (j=0;j<w;j++){ if (maze[i][j]=='#'){ maxi=max(dp[i][j]=min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]))+1,maxi); } } } cout<<(maxi+1)/2<<endl; return 0; }