Submission #1049798

# Submission time Handle Problem Language Result Execution time Memory
1049798 2024-08-09T05:16:01 Z vjudge1 Dango Maker (JOI18_dango_maker) C++17
13 / 100
1 ms 444 KB
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <time.h>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <bits/stdc++.h>

#define speed ios_base::sync_with_stdio(0), cin.tie(0)
#define TxtIO freopen("points.in","r",stdin); freopen("points.out","w",stdout);
using namespace std;
const int mod = 998244353;
#define ll long long
const int N=2e5+5;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll binpow (ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}



ll mark[3005][3005];
void fcn(){
	ll n,m;
	cin>>n>>m;
	
	char a[n+5][m+5];
	for (int i=0; i<n+3; i++){
		for (int j=0; j<m+3; j++){
			a[i][j]='O';
			
		}
	}
	
	for (int i=0; i<n; i++){
		for (int j=0; j<m; j++){
			cin>>a[i][j];
			
		}
	}
	
	ll res=0;
	for (int l=0; l<min(m,n); l++){
		
		
		for (int i=l; i<n; i++){
			ll j=l;
			if (a[i][j]=='R'&&a[i+1][j]=='G'&&a[i+2][j]=='W'&&!mark[i+1][j]&&!mark[i+2][j]&&!mark[i][j]){
				
				res++;
				mark[i+1][j]=1;
				mark[i+2][j]=1;
				mark[i][j]=1;
			}else if (a[i][j]=='R'&&a[i][j+1]=='G'&&a[i][j+2]=='W'&&!mark[i][j+1]&&!mark[i][j+2]&&!mark[i][j]){
				res++;
				mark[i][j]=1;
				mark[i][j+1]=1;
				mark[i][j+2]=1;
			}
			
			
		}
		
		for (int j=l; j<m; j++){
			ll i=l;
			if (a[i][j]=='R'&&a[i+1][j]=='G'&&a[i+2][j]=='W'&&!mark[i+1][j]&&!mark[i+2][j]&&!mark[i][j]){
				res++;
				mark[i][j]=1;
				mark[i+1][j]=1;
				mark[i+2][j]=1;
			}else if (a[i][j]=='R'&&a[i][j+1]=='G'&&a[i][j+2]=='W'&&!mark[i][j+1]&&!mark[i][j+2]&&!mark[i][j]){
				res++;
				mark[i][j]=1;
				mark[i][j+1]=1;
				mark[i][j+2]=1;
			}
			
			
		}
		
		
	}
	
	cout<<res;
}                        

int main(){
	//srand(time(0));
	//fflush(stdout);
//	freopen("bridges.in","r",stdin); freopen("bridges.out","w",stdout);
	
	
//	speed;
	ll T=1;
//	cin>>T;
	for (int i=1; i<=T; i++){
		fcn();	
	}
}




 

/*

1
2 3
4 5
6 7


*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 444 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 444 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Incorrect 0 ms 348 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 444 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Incorrect 0 ms 348 KB Output isn't correct
21 Halted 0 ms 0 KB -