結果

問題 No.402 最も海から遠い場所
ユーザー Tawara
提出日時 2016-07-22 00:42:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 55,432 KB
実行使用メモリ 14,720 KB
最終ジャッジ日時 2024-11-06 12:20:57
合計ジャッジ時間 2,563 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d %d",&H,&W);
      |         ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)

string S[3000];
int HD[3002][3002],VD[3002][3002];
int main(){
	int H,W,ans = 0;
	scanf("%d %d",&H,&W);
	if ((H < 1)||(H > 3000)){
		throw "H is bad!";
		return -1;
	}
	if ((W < 1)||(W > 3000)){
		throw "W is bad!";
		return -1;
	}
	rep(i,H){
		cin >> S[i];
		if (S[i].size() != W){
			//fprintf(stderr,"%dth size:%d!=W:%d.\n",i,S[i].size(),W);
			throw "row size";
		}
		rep(j,W){
			if ((S[i][j] != '#') && (S[i][j] != '.')){
				//fprintf(stderr,"(%d,%d):%c is wrong.\n",i,j,S[i][j]);
				throw "row element";
			}
		}
	}
	return 0;
}
0