AtCoder Grand Contest 015

Submission #1574411

Source codeソースコード

#include <bits/stdc++.h>
#define y1 fvck_y1
using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}

int B1[4010][4010],B2[4010][4010];
char sd[10000];
int n,m,q;
int main()
{
	freopen("read.in","r",stdin);
	n=read(); m=read(); q=read();
	for(int i=1;i<=n;i++)
	{
		scanf("%s",sd);
		for(int j=0;j<m;j++)
			B1[i][j+1]=sd[j]-'0';
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(j!=m) B2[i*2-1][j*2]=B1[i][j]&B1[i][j+1];
			if(i!=n) B2[i*2][j*2-1]=B1[i][j]&B1[i+1][j];
		}
	}
	for(int i=1;i<n*2;i++) for(int j=1;j<m*2;j++)
		B2[i][j]+=B2[i-1][j]+B2[i][j-1]-B2[i-1][j-1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
		B1[i][j]+=B1[i-1][j]+B1[i][j-1]-B1[i-1][j-1];
	for(int i=1;i<=q;i++)
	{
		int x1=read(), y1=read(),x2=read(), y2=read();
		int X=B1[x2][y2]+B1[x1-1][y1-1]-B1[x1-1][y2]-B1[x2][y1-1];
		int Y=B2[x2*2-1][y2*2-1]+B2[x1*2-2][y1*2-2]-B2[x1*2-2][y2*2-1]-B2[x2*2-1][y1*2-2];
		printf("%d\n",X-Y);
	}
	
	return 0;
}

Submission

Task問題 C - Nuske vs Phantom Thnook
User nameユーザ名 Van♂Darkholme
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 TLE
Score得点 0
Source lengthソースコード長 1128 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:30: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("read.in","r",stdin);
^
./Main.cpp:22:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",sd);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt
All 0 / 700 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,09.txt,10.txt,11.txt,12.txt,13.txt,14.txt,15.txt,16.txt,17.txt,18.txt,19.txt,20.txt,21.txt,22.txt,23.txt,24.txt,25.txt,26.txt,27.txt,28.txt,29.txt,30.txt,31.txt,32.txt,33.txt,34.txt,35.txt,36.txt,37.txt,38.txt,39.txt,40.txt,41.txt,42.txt,43.txt,44.txt,45.txt,46.txt,47.txt,48.txt,s1.txt,s2.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt TLE
02.txt TLE
03.txt TLE
04.txt TLE
05.txt TLE
06.txt TLE
07.txt TLE
08.txt TLE
09.txt TLE
10.txt TLE
11.txt TLE
12.txt TLE
13.txt TLE
14.txt TLE
15.txt TLE
16.txt TLE
17.txt TLE
18.txt TLE
19.txt TLE
20.txt TLE
21.txt TLE
22.txt TLE
23.txt TLE
24.txt TLE
25.txt TLE
26.txt TLE
27.txt TLE
28.txt TLE
29.txt TLE
30.txt TLE
31.txt TLE
32.txt TLE
33.txt TLE
34.txt TLE
35.txt TLE
36.txt TLE
37.txt TLE
38.txt TLE
39.txt TLE
40.txt TLE
41.txt TLE
42.txt TLE
43.txt TLE
44.txt TLE
45.txt TLE
46.txt TLE
47.txt TLE
48.txt TLE
s1.txt TLE
s2.txt TLE