Submission #704555

#TimeUsernameProblemLanguageResultExecution timeMemory
704555089487Dango Maker (JOI18_dango_maker)C++14
13 / 100
2055 ms332 KiB
#pragma GCC optimzize("Ofast,no-stack-protector") #include<bits/stdc++.h> #define int long long #define quick ios::sync_with_stdio(0);cin.tie(0); #define rep(x,a,b) for(int x=a;x<=b;x++) #define repd(x,a,b) for(int x=a;x>=b;x--) #define lowbit(x) (x&-x) #define sz(x) (int)(x.size()) #define F first #define S second #define all(x) x.begin(),x.end() #define mp make_pair #define eb emplace_back using namespace std; typedef complex<int> P; #define X real() #define Y imag() typedef pair<int,int> pii; void debug(){ cout<<"\n"; } template <class T,class ... U > void debug(T a, U ... b){ cout<<a<<" ",debug(b...); } const int INF=1e18; int n,m; const int N=200; char c[N][N]; bool vis[N][N]; char col[3]={'R','G','W'}; int ans=0; int sum=0; vector<pii> v; void dfs(int s){ // debug(x,y); if(s>=sz(v)){ ans=max(ans,sum); return ; } int x,y; tie(x,y)=v[s]; bool ok1=(y+2<=m); if(ok1){ rep(i,y,y+2){ if(c[x][i]!=col[i-y]||vis[x][i]) ok1=false; } if(ok1){ rep(i,y,y+2) vis[x][i]=true; sum+=1; dfs(s+1); rep(i,y,y+2) vis[x][i]=false; sum-=1; } } ok1=(x+2<=n); if(ok1){ rep(i,x,x+2){ if(c[i][y]!=col[i-x]||vis[i][y]) ok1=false; } if(ok1){ rep(i,x,x+2) vis[i][y]=true; sum+=1; dfs(s+1); rep(i,x,x+2) vis[i][y]=false; sum-=1; } } dfs(s+1); } signed main(){ quick cin>>n>>m; rep(i,1,n) rep(j,1,m) cin>>c[i][j]; rep(i,1,n){ rep(j,1,m){ if(c[i][j]=='R'){ bool ok1=(j+2<=m); if(ok1){ rep(d,0,2) ok1&=(c[i][j+d]==col[d]); } if(!ok1){ ok1=(i+2<=n); if(ok1) rep(d,0,2) ok1&=(c[i+d][j]==col[d]); } if(ok1) v.eb(mp(i,j)); } } } dfs(0); cout<<ans<<"\n"; return 0; }

Compilation message (stderr)

dango_maker.cpp:1: warning: ignoring '#pragma GCC optimzize' [-Wunknown-pragmas]
    1 | #pragma GCC optimzize("Ofast,no-stack-protector")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...