Submission #116119

# Submission time Handle Problem Language Result Execution time Memory
116119 2019-06-10T15:54:09 Z faustaadp Dango Maker (JOI18_dango_maker) C++17
100 / 100
241 ms 56184 KB
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,m,i,j,has,te;
char a[3030][3030];
int x[9000010];
bool mat[3000010];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			cin>>a[i][j];
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			if(j+2<=m&&a[i][j]=='R'&&a[i][j+1]=='G'&&a[i][j+2]=='W')
			{
				te++;
				has++;
				x[(i-1)*m+j]=te;
				x[(i-1)*m+j+1]=te;
				x[(i-1)*m+j+2]=te;
			}
		}
	ll hai=te;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			if(i+2<=n&&a[i][j]=='R'&&a[i+1][j]=='G'&&a[i+2][j]=='W')
			{
				te++;
				has++;
				ll udah=0;
				if(x[(i-1)*m+j]!=0)
				{
					if(mat[x[(i-1)*m+j]]==0)
					{
						mat[x[(i-1)*m+j]]=1;
						udah=1;
					}
				}
				if(x[(i)*m+j]!=0)
				{
					if(mat[x[(i)*m+j]]==0&&udah==0)
					{
						mat[x[(i)*m+j]]=1;
						udah=1;
					}
				}
				if(x[(i+1)*m+j]!=0)
				{
					if(mat[x[(i+1)*m+j]]==0&&udah==0)
					{
						mat[x[(i+1)*m+j]]=1;
						udah=1;
					}
				}
				has-=udah;
			}				
		}
	cout<<has<<"\n";
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:31:5: warning: unused variable 'hai' [-Wunused-variable]
  ll hai=te;
     ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 2 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 2 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 2 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 2 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 9 ms 9284 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 8 ms 6400 KB Output is correct
58 Correct 29 ms 7288 KB Output is correct
59 Correct 240 ms 44840 KB Output is correct
60 Correct 233 ms 44792 KB Output is correct
61 Correct 241 ms 44824 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 230 ms 43640 KB Output is correct
64 Correct 160 ms 56184 KB Output is correct
65 Correct 169 ms 56184 KB Output is correct
66 Correct 173 ms 56184 KB Output is correct
67 Correct 137 ms 18132 KB Output is correct
68 Correct 138 ms 18372 KB Output is correct
69 Correct 153 ms 28176 KB Output is correct
70 Correct 22 ms 8568 KB Output is correct
71 Correct 24 ms 8568 KB Output is correct
72 Correct 24 ms 8696 KB Output is correct
73 Correct 23 ms 8576 KB Output is correct
74 Correct 30 ms 8576 KB Output is correct
75 Correct 24 ms 8568 KB Output is correct
76 Correct 23 ms 8568 KB Output is correct
77 Correct 22 ms 8576 KB Output is correct
78 Correct 23 ms 8576 KB Output is correct
79 Correct 22 ms 8576 KB Output is correct
80 Correct 22 ms 8568 KB Output is correct
81 Correct 24 ms 8680 KB Output is correct
82 Correct 23 ms 8576 KB Output is correct
83 Correct 23 ms 8576 KB Output is correct
84 Correct 23 ms 8568 KB Output is correct
85 Correct 23 ms 8568 KB Output is correct
86 Correct 25 ms 8584 KB Output is correct
87 Correct 23 ms 8576 KB Output is correct
88 Correct 23 ms 8576 KB Output is correct
89 Correct 22 ms 8568 KB Output is correct
90 Correct 25 ms 8496 KB Output is correct