QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#605652 | #7733. Cool, It’s Yesterday Four Times More | Godwang | Compile Error | / | / | C++23 | 7.4kb | 2024-10-02 18:19:45 | 2024-10-02 18:19:47 |
Judging History
answer
#include <iostream>
using namespace std;
#include <set>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <string>
#include <cstring>
#include <string.h>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <ctype.h>
#include <vector>
#include <random>
#include<list>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n; i >= a; i--)
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define lowbit(x) ((x)&(-x))
ll extend_gcd(ll a, ll b, ll &x, ll &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
ll d = extend_gcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
ll fastpow(ll a, ll n, ll mod)
{
ll ans = 1;
a %= mod;
while (n)
{
if (n & 1)
ans = (ans * a) % mod; //% mod
a = (a * a) % mod; //% mod
n >>= 1;
}
return ans;
}
inline void write(__int128 x)
{
if (x > 9)
{
write(x / 10);
}
putchar(x % 10 + '0');
}
__int128 sqrt(__int128 m)
{
__int128 leftt = 0, rightt = ((__int128)1) << 51, ret = -1, mid;
while (leftt < rightt)
{
mid = (leftt + rightt) / 2;
if (mid * mid > m)
{
rightt = mid;
}
else
{
leftt = mid + 1;
ret = mid;
}
}
return ret;
}
const double eps = 1e-6;
int sgn(double x)
{
if(fabs(x)<eps)
{
return 0;
}
else return x<0?-1:1;
}
struct Point
{
double x,y;
Point()
{
}
Point(double x,double y):x(x),y(y)
{
}
Point operator + (Point B)
{
return Point(x+B.x,y+B.y);
}
Point operator - (Point B)
{
return Point(x-B.x,y-B.y);
}
bool operator == (Point B)
{
return sgn(x-B.x)==0&&sgn(y-B.y)==0;
}
bool operator < (Point B)
{
return sgn(x-B.x)<0||(sgn(x-B.x)==0&&sgn(y-B.y)<0);
}
};
typedef Point Vector;
double Cross(Vector A,Vector B)//叉积
{
return A.x*B.y-A.y*B.x;
}
double Distance(Point A,Point B)
{
return hypot(A.x-B.x,A.y-B.y);
}
int Convex_hull(Point *p,int n,Point *ch)
{
n=unique(p,p+n)-p;
sort(p,p+n);
int v=0;
for(int i=0;i<n;i++)
{
while (v>1&&sgn(Cross(ch[v-1]-ch[v-2],p[i]-ch[v-1]))<=0)
{
v--;
}
ch[v++]=p[i];
}
int j=v;
for(int i=n-2;i>=0;i--)
{
while (v>j&&sgn(Cross(ch[v-1]-ch[v-2],p[i]-ch[v-1]))<=0)
{
v--;
}
ch[v++]=p[i];
}
if(n>1)
{
v--;
}
return v;
}
int kmp(string s, string p)
{
int ans = 0, lastt = -1;
int lenp = p.size();
vector<int > Next(lenp+3,0);
rep(i, 1, lenp - 1)
{
int j = Next[i];
while (j && p[j] != p[i])
{
j = Next[j];
}
if (p[j] == p[i])
{
Next[i + 1] = j + 1;
}
else
{
Next[i + 1] = 0;
}
}
int lens = s.size();
int j = 0;
rep(i, 0, lens - 1)
{
while (j && s[i] != p[j])
{
j = Next[j];
}
if (s[i] == p[j])
{
j++;
}
if (j == lenp)
{
ans++;
}
}
return ans;
}
int dir[4][2] =
{
{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // 左右上下
// int dir[8][2]={
// {-1, 0}, {0, 1}, {1, 0}, {0, -1},{-1,-1},{-1,1},{1,-1},{1,1}
// };
#define endl '\n'//交互题请删除本行
const ll inf = 1000000000000000000ll;
const ll mod1 = 998244353ll, P1 = 131, mod2 = 1e9 + 7ll, P2 = 13331;
ll inverse(ll x)
{
return fastpow(x,mod1-2,mod1);
}
const int N = 1e4 + 10, M = 2e6 + 10;
///////////////////////////////////
int tt;
int n,m;
string s[N];
int win[M];
bool vis[M];
//map<node,bool > ma;
int ans;
int son;
queue<array<int ,4>> q;
bool flag;
///////////////////////////////////
ll get(int i,int j,int ii,int jj)
{
return i*(m+1)*(n+1)*(m+1)+j*(n+1)*(m+1)+ii*(m+1)+jj;
}
void dfs(int i,int j,int ii,int jj)
{
//
// cout<<i<<" "<<j<<" "<<ii<<" "<<jj<<endl;
if(i<1||i>n||j<1||j>m||s[i][j]=='O')
{
return;
}
if(s[i][j]=='.'&&( (ii<1||ii>n||jj<1||jj>m) )|| s[ii][jj]=='O' )
{
flag=1;
//
if(flag)
{
//
}
return;
}
if(vis[get(i,j,ii,jj)])
{
return;
}
//
vis[get(i,j,ii,jj)]=1;
array<int ,4> arr{i,j,ii,jj};
q.push(arr);
rep(k,0,3)
{
int x1=i+dir[k][0],y1=j+dir[k][1],x2=ii+dir[k][0],y2=jj+dir[k][1];
//
//cout<<dir[i][0]<<" "<<dir[i][1]<<endl;
dfs(x1,y1,x2,y2);
}
}
///////////////////////////////////
void init()
{
ans=0;
son=0;
rep(i,1,(n+3)*(m+1)*(n+1)*(m+1))
{
win[i]=0;
vis[i]=0;
}
}
///////////////////////////////////
int main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);//交互题请删除本行
// freopen("ain.txt", "r", stdin); freopen("aout.txt", "w", stdout);
cin>>tt;
while (tt--)
{
cin>>n>>m;
init();
rep(i,1,n)
{
cin>>s[i];
s[i]=' '+s[i];
rep(j,1,m)
{
if(s[i][j]=='.')
{
son++;
}
}
}
rep(i,1,n)
{
rep(j,1,m)
{
if(s[i][j]=='O')
{
continue;
}
int ok=0;
rep(ii,1,n)
{
rep(jj,1,m)
{
if(s[ii][jj]=='O'||ii==i&&jj==j)
{
continue;
}
flag=0;
if(vis[get(i,j,ii,jj)])
{
if(win[get(i,j,ii,jj)])
{
ok++;
}
continue;
}
dfs(i,j,ii,jj);
while (q.size())
{
array<int ,4> arr=q.front();
q.pop();
win[get(arr[0],arr[1],arr[2],arr[3])]=flag;
}
//
if(win[get(i,j,ii,jj)])
{
// cout<<i<<" "<<j<<" "<<ii<<" "<<jj<<" OK"<<endl;
ok++;
}
}
}
if(ok+1==son)
{
ans++;
}
}
}
cout<<ans<<endl;
}
return 0;
}
Details
answer.code: In function ‘void dfs(int, int, int, int)’: answer.code:278:19: error: variable ‘std::array<int, 4> arr’ has initializer but incomplete type 278 | array<int ,4> arr{i,j,ii,jj}; | ^~~ answer.code: In function ‘int main()’: answer.code:362:43: error: variable ‘std::array<int, 4> arr’ has initializer but incomplete type 362 | array<int ,4> arr=q.front(); | ^~~ In file included from /usr/include/c++/13/deque:66, from /usr/include/c++/13/stack:62, from answer.code:15: /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >]’: /usr/include/c++/13/bits/stl_queue.h:321:13: required from ‘void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::array<int, 4>; _Sequence = std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >]’ answer.code:363:34: required from here /usr/include/c++/13/bits/stl_deque.h:1578:47: error: invalid use of incomplete type ‘struct std::array<int, 4>’ 1578 | != this->_M_impl._M_start._M_last - 1) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/13/bits/uses_allocator_args.h:38, from /usr/include/c++/13/bits/memory_resource.h:41, from /usr/include/c++/13/string:58, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from answer.code:1: /usr/include/c++/13/tuple:2005:45: note: declaration of ‘struct std::array<int, 4>’ 2005 | template<typename _Tp, size_t _Nm> struct array; | ^~~~~ /usr/include/c++/13/bits/stl_deque.h:1582:38: error: cannot increment a pointer to incomplete type ‘std::array<int, 4>’ 1582 | ++this->_M_impl._M_start._M_cur; | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::_Deque_base<_Tp, _Alloc>::_M_initialize_map(std::size_t) [with _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >; std::size_t = long unsigned int]’: /usr/include/c++/13/bits/stl_deque.h:460:9: required from ‘std::_Deque_base<_Tp, _Alloc>::_Deque_base() [with _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >]’ /usr/include/c++/13/bits/stl_deque.h:855:7: required from ‘std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >; _Requires = void; _Tp = std::array<int, 4>; _Sequence = std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >]’ answer.code:241:22: required from here /usr/include/c++/13/bits/stl_deque.h:641:69: error: invalid application of ‘sizeof’ to incomplete type ‘std::array<int, 4>’ 641 | const size_t __num_nodes = (__num_elements / __deque_buf_size(sizeof(_Tp)) | ^~~~~~~~~~~ /usr/include/c++/13/bits/stl_deque.h:672:60: error: invalid application of ‘sizeof’ to incomplete type ‘std::array<int, 4>’ 672 | % __deque_buf_size(sizeof(_Tp))); | ^~~~~~~~~~~ /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::deque<_Tp, _Alloc>::_M_destroy_data(iterator, iterator, const std::allocator<_CharT>&) [with _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >; iterator = std::_Deque_base<std::array<int, 4>, std::allocator<std::array<int, 4> > >::iterator]’: /usr/include/c++/13/bits/stl_deque.h:1028:24: required from ‘std::deque<_Tp, _Alloc>::~deque() [with _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >]’ /usr/include/c++/13/bits/stl_queue.h:167:4: required from ‘std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >; _Requires = void; _Tp = std::array<int, 4>; _Sequence = std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >]’ answer.code:241:22: required from here /usr/include/c++/13/bits/stl_deque.h:2090:14: error: invalid use of incomplete type ‘std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >::value_type’ {aka ‘struct std::array<int, 4>’} [-fpermissive] 2090 | if (!__has_trivial_destructor(value_type)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/tuple:2005:45: note: declaration of ‘std::deque<std::array<int, 4>, std::allocator<std::array<int, 4> > >::value_type’ {aka ‘struct std::array<int, 4>’} 2005 | template<typename _Tp, size_t _N...