QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#135233 | #4434. Lemurs | Sommohito# | WA | 43ms | 103276kb | C++20 | 3.0kb | 2023-08-05 13:05:04 | 2023-08-05 13:05:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
#define ALL(x) x.begin(),x.end()
const int N = 4050;
int a[N][N];
int vis[N][N];
int n,m,k;
int scale;
int p[N][N];
int lim;
int lim2;
void init()
{
for(int i=-(n+m)+scale; i<=(n+m)+scale; i++)
{
for(int j=-(n+m)+scale; j<=(n+m)+scale; j++)
{
p[i][j] = p[i-1][j] + p[i][j-1] - p[i-1][j-1] + a[i][j];
}
}
}
void init2()
{
for(int i=-(n+m)+scale; i<=(n+m)+scale; i++)
{
for(int j=-(n+m)+scale; j<=(n+m)+scale; j++)
{
vis[i][j] = vis[i-1][j] + vis[i][j-1] - vis[i-1][j-1] + vis[i][j];
}
}
}
void add(int i1, int j1, int i2, int j2)
{
vis[i1][j1] = 1;
if(i1+1<=lim)
vis[i1+1][j1] = 1;
if(j1+1<=lim)
vis[i1][j1+1] = 1;
if(i1+1<=lim && j1+1<=lim)
vis[i1+1][j1+1] = 1;
}
inline int query(int i1, int j1, int i2, int j2)
{
return p[i2][j2] - p[i1-1][j2] - p[i2][j1-1] + p[i1-1][j1-1];
}
inline int zero(int i1, int j1, int i2, int j2)
{
return (i2-i1+1)*(j2-j1+1) - query(i1,j1,i2,j2);
}
void TEST_CASES()
{
cin>>n>>m>>k;
scale = n + m + 1;
for(int i=-(n+m); i<=(n+m); i++)
{
for(int j=-(n+m); j<=(n+m); j++)
{
a[i+scale][j+scale] = 1;
p[i+scale][j+scale] = 0;
vis[i+scale][j+scale] = 0;
}
}
lim = n+m+scale;
lim2 = -(n+m)+scale;
vector<string>s(n);
for(int i=0; i<n; i++)
cin>>s[i];
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
int x = i+j;
int y = j-i;
if(s[i][j]=='.')
{
a[x+scale][y+scale] = 0;
}
}
}
init();
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
int x = i+j;
int y = j-i;
if(s[i][j]=='.')
{
continue;
}
int cnt = zero(max(x-k+scale,lim2),max(y-k+scale,lim2),min(x+scale+k,lim),min(y+scale+k,lim));
assert(cnt>=0);
if(!cnt)
{
add(max(x-k+scale,lim2),max(y-k+scale,lim2),min(x+scale+k,lim),min(y+scale+k,lim));
}
}
}
init2();
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
int x = i+j;
int y = j-i;
if(s[i][j]=='x' && !vis[x+scale][y+scale])
{
cout<<"NIE\n";
return;
}
}
}
cout<<"TAK\n";
}
/*
2
3 3 1
...
..x
..x
3 4 1
..xx
x.xx
x..x
*/
int32_t main()
{
#ifndef APURBA
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#endif
int t=1;
cin>>t;
while(t--)
{
TEST_CASES();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 43ms
memory: 103276kb
input:
4000 1 1 1 . 1 1 1 x 1 1 1000 . 1 1 1000 x 1 1000 4 ..........................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx....xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
TAK TAK TAK TAK TAK NIE NIE TAK NIE TAK NIE NIE TAK TAK NIE TAK TAK NIE NIE TAK NIE NIE NIE NIE NIE NIE TAK NIE TAK TAK TAK TAK NIE NIE NIE TAK TAK NIE TAK TAK NIE TAK NIE TAK NIE NIE NIE TAK NIE NIE NIE NIE TAK NIE NIE TAK TAK TAK NIE NIE TAK NIE TAK NIE NIE NIE NIE NIE TAK TAK NIE NIE NIE TAK TAK ...
result:
wrong answer 20th lines differ - expected: 'NIE', found: 'TAK'