Submission #209288

#TimeUsernameProblemLanguageResultExecution timeMemory
209288kshitij_sodaniDango Maker (JOI18_dango_maker)C++14
0 / 100
77 ms141328 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int llo;
#define a first
#pragma GCC optimize("no-stack-protector")
#pragma comment(linker, "/stack:200000000")
#define  b second
#define endl "\n"
//vector<pair<pair<int,int>,int>> adj[3001][3001][2];
//int vis[3001][3001][2];
int dp[3001][3001][2][2];//1 take 0 not take
int it[3001][3001];
/*int dfs(int ii,int jj,int kk){
	vis[ii][jj][kk]=1;
	dp[ii][jj][kk][1]=1;
	for(auto nn:adj[ii][jj][kk]){
		int aa;
		int bb;
		int cc;
		aa=nn.a.a;
		bb=nn.a.b;
		cc=nn.b;
		if(vis[aa][bb][cc]==0){
			dfs(aa,bb,cc);
			dp[ii][jj][kk][0]+=dp[aa][bb][cc][1];
			dp[ii][jj][kk][1]+=dp[aa][bb][cc][0];
		}
	}
	dp[ii][jj][kk][1]=max(dp[ii][jj][kk][1],dp[ii][jj][kk][0]);
}*/
int main(){
	ios_base::sync_with_stdio(false);
//	memset(vis,1,sizeof(vis));
	cin.tie(NULL);
	memset(dp,0,sizeof(dp));
	int n,m;
	char s;
	cin>>n>>m;
	//int it[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>s;
			if(s=='R'){
				it[i][j]=0;
			}
			else if(s=='G'){
				it[i][j]=1;
			}
			else{
				it[i][j]=2;
			}
	//		cout<<it[i][j]<<" ";
		}
	//	cout<<endl;
	}
	/*int st=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m-2;j++){
			if(it[i][j]==0 and it[i][j+1]==1 and it[i][j+2]==2){
				vis[i][j][1]=0;
			//	cout<<i<<" "<<j<<" "<<1<<endl;
			}
		}
	}
	for(int i=0;i<n-2;i++){
		for(int j=0;j<m;j++){
			if(it[i][j]==0 and it[i+1][j]==1 and it[i+2][j]==2){
				vis[i][j][0]=0;
				//cout<<i<<" "<<j<<" "<<0<<endl;
				if(j<m-2){
					if(it[i][j+1]==1 and it[i][j+2]==2){
						adj[i][j][0].pb(mp(mp(i,j),1));
						adj[i][j][1].pb(mp(mp(i,j),0));
					}
				}
				if(j<m-1 and j>0){
					if(it[i+1][j-1]==0 and it[i+1][j+1]==2){
						adj[i][j][0].pb(mp(mp(i+1,j-1),1));
						adj[i+1][j-1][1].pb(mp(mp(i,j),0));
					}
				}
				if(j>1){
					if(it[i+2][j-2]==0 and it[i+2][j-1]==1){
						adj[i][j][0].pb(mp(mp(i+2,j-2),1));
						adj[i+2][j-2][1].pb(mp(mp(i,j),0));
					}
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(vis[i][j][0]==0){
				dfs(i,j,0);
				ans+=dp[i][j][0][1];
			}
			if(vis[i][j][1]==0){
				dfs(i,j,1);
				ans+=dp[i][j][1][1];
			}
		}
	}
	cout<<ans<<endl;
*/

	return 0;
}

Compilation message (stderr)

dango_maker.cpp:9:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/stack:200000000")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...