提出 #69087318


ソースコード 拡げる

#include<bits/stdc++.h>
#define int long long 
using namespace std;
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+(ch^48);
		ch=getchar();
	}
	return x;
}
int n,m,pre[510][510];
char a[510][510];
signed main(){
	n=read(),m=read();
	for(int i=1;i<=n;i++){
		scanf("%s",a[i]+1);
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<n;j++){
			if(a[i][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i+1][j+1]=='.') pre[i][j]=1;
			pre[i][j]+=pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1];
		}
	}
	while(m--){
		int U=read(),D=read(),L=read(),R=read();
		U--,D--,L--,R--;
		printf("%lld\n",pre[D][R]+pre[U][L]-pre[U][R]-pre[D][L]);
	}
	return 0;
}

提出情報

提出日時
問題 A - 2x2 Erasing
ユーザ wrhaco
言語 C++ 20 (gcc 12.2)
得点 400
コード長 735 Byte
結果 AC
実行時間 29 ms
メモリ 6184 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |                 scanf("%s",a[i]+1);
      |                 ~~~~~^~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 28
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3752 KiB
00_sample_01.txt AC 1 ms 3764 KiB
01_handmade_00.txt AC 14 ms 3816 KiB
01_handmade_01.txt AC 20 ms 5884 KiB
01_handmade_02.txt AC 1 ms 3708 KiB
01_handmade_03.txt AC 28 ms 5860 KiB
01_handmade_04.txt AC 22 ms 5848 KiB
02_random_00.txt AC 26 ms 5308 KiB
02_random_01.txt AC 22 ms 4248 KiB
02_random_02.txt AC 28 ms 5912 KiB
02_random_03.txt AC 19 ms 4140 KiB
02_random_04.txt AC 20 ms 4040 KiB
02_random_05.txt AC 28 ms 5980 KiB
02_random_06.txt AC 29 ms 6092 KiB
02_random_07.txt AC 28 ms 6124 KiB
02_random_08.txt AC 29 ms 6184 KiB
02_random_09.txt AC 28 ms 6004 KiB
02_random_10.txt AC 24 ms 6052 KiB
02_random_11.txt AC 23 ms 5840 KiB
02_random_12.txt AC 23 ms 5864 KiB
02_random_13.txt AC 23 ms 5856 KiB
02_random_14.txt AC 23 ms 5860 KiB
02_random_15.txt AC 23 ms 5988 KiB
02_random_16.txt AC 23 ms 6120 KiB
02_random_17.txt AC 23 ms 6184 KiB
02_random_18.txt AC 23 ms 5860 KiB
02_random_19.txt AC 23 ms 5848 KiB
02_random_20.txt AC 26 ms 5900 KiB