답안 #153795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153795 2019-09-16T11:08:07 Z dennisstar Dango Maker (JOI18_dango_maker) C++11
100 / 100
459 ms 118392 KB
#include <bits/stdc++.h>
#define X 5010
int N, M, G[X][X],S[X][X],p,s[X*2],a[X*2];
char C[X][X];
int g()
{
	int i,t=1;
	s[0]=-1;
	for(i=0;i<p;i++){
		if(s[t-1]<a[i])s[t++]=a[i];
		else s[std::lower_bound(s,s+t,a[i])-s]=a[i];
	}
	return t-1;
}
int f()
{
	int i,k,r=0;
	for(k=0;k<N+M-1;k++){
		p=0;
		for(i=std::max(0,k-M+1);i<N&&i<=k;i++){
			if(S[i][k-i])a[p++]=2*i+5;
			if(G[i][k-i])a[p++]=2*i;
		}
		r+=g();
	}
	return r;
}
int main()
{
	scanf("%d%d",&N,&M);
	int i,j;
	for(i=0;i<N;i++) scanf("%s",C[i]);
	for(i=0;i<N;i++) for(j=0;j<M;j++) {
		if(C[i][j]=='R'){
			if(C[i+1][j]=='G'&&C[i+2][j]=='W')S[i][j]=1;
			if(C[i][j+1]=='G'&&C[i][j+2]=='W')G[i][j]=1;
		}
	}
	printf("%d",f());
	return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&N,&M);
  ~~~~~^~~~~~~~~~~~~~
dango_maker.cpp:32:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<N;i++) scanf("%s",C[i]);
                   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 2 ms 504 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 504 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 476 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 504 KB Output is correct
40 Correct 2 ms 504 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 504 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 3 ms 376 KB Output is correct
46 Correct 2 ms 504 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 ms 380 KB Output is correct
51 Correct 2 ms 504 KB Output is correct
52 Correct 2 ms 504 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 2 ms 504 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 504 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 476 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 504 KB Output is correct
40 Correct 2 ms 504 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 504 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 3 ms 376 KB Output is correct
46 Correct 2 ms 504 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 ms 380 KB Output is correct
51 Correct 2 ms 504 KB Output is correct
52 Correct 2 ms 504 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
54 Correct 2 ms 376 KB Output is correct
55 Correct 19 ms 13000 KB Output is correct
56 Correct 2 ms 504 KB Output is correct
57 Correct 18 ms 18424 KB Output is correct
58 Correct 40 ms 21800 KB Output is correct
59 Correct 454 ms 117308 KB Output is correct
60 Correct 459 ms 117320 KB Output is correct
61 Correct 425 ms 117240 KB Output is correct
62 Correct 2 ms 376 KB Output is correct
63 Correct 414 ms 114596 KB Output is correct
64 Correct 413 ms 118372 KB Output is correct
65 Correct 418 ms 118392 KB Output is correct
66 Correct 419 ms 118248 KB Output is correct
67 Correct 271 ms 39800 KB Output is correct
68 Correct 264 ms 39928 KB Output is correct
69 Correct 288 ms 50140 KB Output is correct
70 Correct 39 ms 22008 KB Output is correct
71 Correct 37 ms 22116 KB Output is correct
72 Correct 37 ms 22008 KB Output is correct
73 Correct 41 ms 22180 KB Output is correct
74 Correct 38 ms 22136 KB Output is correct
75 Correct 38 ms 22008 KB Output is correct
76 Correct 38 ms 22136 KB Output is correct
77 Correct 38 ms 22008 KB Output is correct
78 Correct 39 ms 22136 KB Output is correct
79 Correct 37 ms 22008 KB Output is correct
80 Correct 38 ms 22012 KB Output is correct
81 Correct 37 ms 22008 KB Output is correct
82 Correct 37 ms 22008 KB Output is correct
83 Correct 38 ms 22008 KB Output is correct
84 Correct 38 ms 22008 KB Output is correct
85 Correct 45 ms 22008 KB Output is correct
86 Correct 40 ms 22296 KB Output is correct
87 Correct 38 ms 22008 KB Output is correct
88 Correct 38 ms 22112 KB Output is correct
89 Correct 39 ms 22084 KB Output is correct
90 Correct 39 ms 22136 KB Output is correct