답안 #255628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
255628 2020-08-01T13:06:45 Z tleontest1 Dango Maker (JOI18_dango_maker) C++17
100 / 100
1507 ms 18272 KB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 3005;
const lo mod = 1000000007;

int n,m,b[li],a[li],flag,t,vis[li][li],vis1[li][li],visit[li][li];
int ans;
char c[li][li];
string s;
vector<int> v;

int main(void){
	scanf("%d %d",&n,&m);
	FOR{
		for(int j=1;j<=m;j++){
			scanf(" %c",&c[i][j]);
		}
	}
	FOR{
		for(int j=1;j<=m;j++){
			if(c[i][j]!='G')continue;
			vector<PII> vec;
			vector<PII> dp;
			for(int k=0;k<j;k++){
				if(k+i>n)continue;
				if(c[i+k][j-k]=='G'){
					vec.pb({i+k,j-k});
				}
				else break;
			}
			for(int i=0;i<(int)vec.size()+10;i++)dp.pb({0,0});
			for(int i=(int)vec.size()-1;i>=0;i--){
				dp[i].fi=max(dp[i+1].fi,dp[i+2].se)+(c[vec[i].fi][vec[i].se-1]=='R' && c[vec[i].fi][vec[i].se+1]=='W'?1:0);
				dp[i].se=max(dp[i+1].se,dp[i+2].fi)+(c[vec[i].fi-1][vec[i].se]=='R' && c[vec[i].fi+1][vec[i].se]=='W'?1:0);
				c[vec[i].fi][vec[i].se]='.';
			}
			ans+=max(dp[0].fi,dp[0].se);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:36: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:39:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&c[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 0 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 0 ms 384 KB Output is correct
25 Correct 0 ms 384 KB Output is correct
26 Correct 0 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct
33 Correct 0 ms 416 KB Output is correct
34 Correct 0 ms 384 KB Output is correct
35 Correct 0 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 0 ms 384 KB Output is correct
39 Correct 1 ms 384 KB Output is correct
40 Correct 0 ms 384 KB Output is correct
41 Correct 0 ms 384 KB Output is correct
42 Correct 1 ms 384 KB Output is correct
43 Correct 0 ms 384 KB Output is correct
44 Correct 0 ms 384 KB Output is correct
45 Correct 0 ms 384 KB Output is correct
46 Correct 1 ms 384 KB Output is correct
47 Correct 0 ms 384 KB Output is correct
48 Correct 1 ms 384 KB Output is correct
49 Correct 1 ms 384 KB Output is correct
50 Correct 0 ms 384 KB Output is correct
51 Correct 0 ms 384 KB Output is correct
52 Correct 0 ms 384 KB Output is correct
53 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 0 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 0 ms 384 KB Output is correct
25 Correct 0 ms 384 KB Output is correct
26 Correct 0 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct
33 Correct 0 ms 416 KB Output is correct
34 Correct 0 ms 384 KB Output is correct
35 Correct 0 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 0 ms 384 KB Output is correct
39 Correct 1 ms 384 KB Output is correct
40 Correct 0 ms 384 KB Output is correct
41 Correct 0 ms 384 KB Output is correct
42 Correct 1 ms 384 KB Output is correct
43 Correct 0 ms 384 KB Output is correct
44 Correct 0 ms 384 KB Output is correct
45 Correct 0 ms 384 KB Output is correct
46 Correct 1 ms 384 KB Output is correct
47 Correct 0 ms 384 KB Output is correct
48 Correct 1 ms 384 KB Output is correct
49 Correct 1 ms 384 KB Output is correct
50 Correct 0 ms 384 KB Output is correct
51 Correct 0 ms 384 KB Output is correct
52 Correct 0 ms 384 KB Output is correct
53 Correct 0 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 6 ms 9216 KB Output is correct
56 Correct 4 ms 384 KB Output is correct
57 Correct 6 ms 6272 KB Output is correct
58 Correct 147 ms 4216 KB Output is correct
59 Correct 1325 ms 17912 KB Output is correct
60 Correct 1335 ms 17992 KB Output is correct
61 Correct 1326 ms 17992 KB Output is correct
62 Correct 4 ms 384 KB Output is correct
63 Correct 1286 ms 17700 KB Output is correct
64 Correct 647 ms 18164 KB Output is correct
65 Correct 634 ms 18168 KB Output is correct
66 Correct 641 ms 18272 KB Output is correct
67 Correct 1466 ms 18044 KB Output is correct
68 Correct 1507 ms 18040 KB Output is correct
69 Correct 1495 ms 18040 KB Output is correct
70 Correct 71 ms 4344 KB Output is correct
71 Correct 81 ms 4344 KB Output is correct
72 Correct 71 ms 4216 KB Output is correct
73 Correct 71 ms 4344 KB Output is correct
74 Correct 71 ms 4312 KB Output is correct
75 Correct 71 ms 4324 KB Output is correct
76 Correct 83 ms 4344 KB Output is correct
77 Correct 97 ms 4296 KB Output is correct
78 Correct 77 ms 4344 KB Output is correct
79 Correct 80 ms 4220 KB Output is correct
80 Correct 107 ms 4348 KB Output is correct
81 Correct 83 ms 4344 KB Output is correct
82 Correct 80 ms 4344 KB Output is correct
83 Correct 81 ms 4216 KB Output is correct
84 Correct 80 ms 4216 KB Output is correct
85 Correct 78 ms 4216 KB Output is correct
86 Correct 77 ms 4344 KB Output is correct
87 Correct 75 ms 4344 KB Output is correct
88 Correct 80 ms 4248 KB Output is correct
89 Correct 75 ms 4296 KB Output is correct
90 Correct 73 ms 4216 KB Output is correct