QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#625154 | #7733. Cool, It’s Yesterday Four Times More | qinglu09# | WA | 9ms | 5636kb | C++14 | 2.1kb | 2024-10-09 17:41:16 | 2024-10-09 17:41:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define endl '\n'
#define debug(x) cout<<#x<<": "<<x<<endl
#define lowbit(x) (x&-x)
#define gcd __gcd
#define i128 __int128
#define rep(i, a, b) for(ll i = (a); i <= (b); i++)
#define per(i, a, b) for(ll i = (a); i >= (b); i--)
const int N=1e6+10,M=3e6+10;
const ll mod=1e9+7;
const ld eps=1e-12;
const double pi=acos(-1.0);
const double pi1=pi/180,pi2=180/pi;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
//unordered_map<int,int>mp;
#define poly vector<int>
bitset<4005>space[1005],now;
int diff=1001;
int movex[4]={0,0,1,-1};
int movey[4]={1,-1,0,0};
int val[4]={1, -1, 0, 0};
int vis[1005][1005];
char a[1005][1005];
void solve()
{
int n,m;
cin>>n>>m;
for(int i=0;i<n*m;i++) space[i].reset();
val[2] = m;
val[3] = -m;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
function<void(int,int,int,int)>dfs=[&](int id, int x,int y,int pos)
{
space[id][pos]=1;
for(int i=0;i<4;i++)
{
int X=x+movex[i];
int Y=y+movey[i];
if(X>=0&&X<n&&Y>=0&&Y<m&&!vis[X][Y]&&a[X][Y]=='.')
{
vis[X][Y]=1;
dfs(id, X, Y, pos + val[i]);
}
}
};
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(a[i][j]=='.')
{
for(int x=0;x<n;x++)
{
for(int y=0;y<m;y++)
{
vis[x][y]=0;
}
}
vis[i][j]=1;
dfs(i*m+j,i,j,2002);
}
}
}
int ans=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(a[i][j]=='.')
{
bool ok = 1;
for(int x=0;x<n;x++)
{
for(int y=0;y<m;y++)
{
if(x==i&&j==y) continue;
now=space[i*m+j]|space[x*m+y];
if(now==space[x*m+y]) {
ok = 0;
break;
}
}
if(!ok) break;
}
if(ok) ans++;
}
}
}
cout<<ans<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
while(T--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
4 2 5 .OO.. O..O. 1 3 O.O 1 3 .O. 2 3 OOO OOO
output:
3 1 0 0
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 2ms
memory: 5636kb
input:
200 2 4 OOO. OO.. 2 3 OOO .O. 3 3 O.O OOO OO. 4 1 . . O O 1 2 .O 1 1 . 2 5 .OO.. .O.O. 2 1 O O 1 1 O 1 3 .OO 5 1 O O . O . 5 2 O. .. O. .O .. 5 3 ... ... .OO ..O OOO 3 5 ..O.O .O.O. .OO.O 5 2 .O OO O. O. .. 2 1 O O 3 5 .O.OO O...O ..OO. 1 5 ..... 5 1 O . O . . 5 3 OOO OO. .OO OO. O.O 2 1 O . 5 2 O. ...
output:
3 0 0 2 1 1 3 0 0 1 0 7 9 4 4 0 6 5 2 0 1 6 4 5 2 0 0 5 3 3 1 4 1 0 7 5 2 3 7 3 0 6 2 2 2 0 4 6 6 3 3 2 3 5 2 1 0 3 3 4 4 2 2 0 7 6 4 8 5 3 2 5 2 1 2 1 4 0 0 2 5 1 4 6 6 1 6 2 2 3 4 5 2 1 0 1 9 3 4 11 0 3 2 1 0 0 4 3 1 4 3 8 3 0 3 6 2 5 1 3 3 4 0 2 11 2 2 4 0 4 4 6 2 1 2 3 0 5 0 16 4 3 2 6 0 8 3 3 1...
result:
ok 200 lines
Test #3:
score: -100
Wrong Answer
time: 9ms
memory: 3768kb
input:
50 10 9 OOOO.O... O...O.OOO .....O... ..OO..O.O ...O..O.O ..OOO..O. ..OOO...O .OO.O..OO .O.O.OO.. .O..O.O.O 10 10 .O.OOO.OO. ...OOOOOOO ...O.O..O. .O.O..O... .O.O.OO..O ..OO.O..OO O....O..OO OO...OOOOO OO.OO.O..O .O.O.OOOOO 10 8 O..OOO.O O.OOOO.. O..OO.OO OO..OO.. .OOO..O. .OO.OO.O OOO..OO. ..O..OO....
output:
31 40 13 25 40 37 27 29 20 26 25 29 21 29 21 31 32 31 33 34 25 31 18 25 41 28 20 38 20 29 18 21 27 28 35 13 20 17 32 29 28 23 23 23 24 18 28 17 35 24
result:
wrong answer 28th lines differ - expected: '45', found: '38'