QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#240404#3251. 数正方体Cofe_Milk#RE 0ms0kbC++172.2kb2023-11-05 15:14:492023-11-05 15:14:49

Judging History

你现在查看的是最新测评结果

  • [2023-11-05 15:14:49]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-11-05 15:14:49]
  • 提交

answer

//#include<bitsdc++.h>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <set>
#include <list>
#include <map>
#include <cstdlib>
#include <bitset>
#include <limits.h>
using namespace std;
//#define int long long
//#define double long double
#define fi first 
#define se second
#define INF 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define FILL(a,b) (memset(a,b,sizeof(a)))
#define ios std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define endl '\n'
#define rep(i,j,k,l) for(int i=j;i<=k;i+=l)
#define per(i,j,k,l) for(int i=j;i>=k;i-=l)
#define Rep(i,j,k,l) for(int i=j;i<k;i+=l)
#define Per(i,j,k,l) for(int i=j;i>k;i-=l)
#define ls u<<1
#define rs u<<1|1
const int N=110,mod=998244353;
const double eps=1e-8;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef long long ll;
int n,m;
string a[N];
bool check(int x,int y)
{
	for(int i=1;i<=3;i++) 
		if(a[x][y+i]!='-'||a[x+3][y+i]!='-') return false;
	for(int i=1;i<=2;i++)
		if(a[x+i][y]!='|'||a[x+i][y+4]!='|') return false;
	return a[x][y+4]=='+'&&a[x+3][y]=='+'&&a[x+3][y+4]=='+';
}
int dfs(int x,int y)
{
	if(x<1||x>n||y<1||y>m) return 0;
	int sum=0;
	while(y+4<=m&&a[x][y+4]=='+'&&a[x][y+1]=='-'&&a[x][y+2]=='-'&&a[x][y+3]=='-') y+=4;
	if(x-2>=1&&y+2<=m&&a[x-2][y+2]=='+'&&a[x-1][y+1]=='/') sum+=dfs(x-2,y+2)+1;
	return sum;
}
int calc(int x,int y)
{
	if(check(x,y)) return dfs(x,y);	
	else return 0;
}
void solve()
{
	cin>>n>>m;
	getline(cin,a[0]);
	for(int i=1;i<=n;i++)
	{
		getline(cin,a[i]);
		a[i]=" "+a[i];
	}
//	for(int i=1;i<=n;i++)
//	{
//		for(int j=1;j<=m;j++) cout<<a[i][j];
//		cout<<endl;
//	}
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='+') ans+=calc(i,j);
	cout<<ans;
}
signed main()
{
	ios
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

371 259
......................................................................+---+---+....................................................................................................................................................................................
...................................

output:


result: