Submission #69076653
Source Code Expand
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef pair<ll,ll> pl;
typedef pair<ll,pl> ppl;
typedef pair<ll,ppl> pppl;
typedef pair<ll,pppl> pppppl;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) begin(a),end(a)
#define sz(a) (int)(a).size()
#define F first
#define S second
#define bs(A,x) binary_search(all(A),x)
#define lb(A,x) (ll)(lower_bound(all(A),x)-A.begin())
#define ub(A,x) (ll)(upper_bound(all(A),x)-A.begin())
#define cou(A,x) (ll)(upper_bound(all(A),x)-lower_bound(all(A),x))
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
//*
using mint=modint998244353;
const ll mod=998244353;
//*/
/*
using mint=modint1000000007;
const ll mod=1000000007;
//*/
//using mint=modint;
//*
typedef vector<mint> vm;
typedef vector<vm> vvm;
typedef vector<vvm> vvvm;
typedef vector<vvvm> vvvvm;
ostream&operator<<(ostream&os,mint a){os<<a.val();return os;}
istream&operator>>(istream&is,mint&a){int x;is>>x;a=mint(x);return is;}
//*/
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>p){os<<p.F<<" "<<p.S;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.F>>p.S;return is;}
template<typename T>ostream&operator<<(ostream&os,vector<T>v){rep(i,0,sz(v))os<<v[i]<<(i+1!=sz(v)?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
ll N,Q;cin>>N>>Q;
vector<string>S(N);cin>>S;
vvl A(N,vl(N));
rep(i,0,N-1)rep(j,0,N-1){
A[i+1][j+1]=A[i+1][j]+A[i][j+1]-A[i][j];
if(S[i][j]=='.'&&S[i+1][j]=='.'&&S[i][j+1]=='.'&&S[i+1][j+1]=='.')A[i+1][j+1]++;
}
while(Q--){
ll u,d,l,r;cin>>u>>d>>l>>r;u--;l--;
cout<<A[u][l]-A[d-1][l]-A[u][r-1]+A[d-1][r-1]<<endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 2x2 Erasing |
User |
TKTYI |
Language |
C++ 20 (gcc 12.2) |
Score |
400 |
Code Size |
2421 Byte |
Status |
AC |
Exec Time |
226 ms |
Memory |
5592 KiB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00.txt, 00_sample_01.txt |
All |
00_sample_00.txt, 00_sample_01.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
3476 KiB |
00_sample_01.txt |
AC |
1 ms |
3600 KiB |
01_handmade_00.txt |
AC |
209 ms |
3452 KiB |
01_handmade_01.txt |
AC |
217 ms |
5532 KiB |
01_handmade_02.txt |
AC |
1 ms |
3392 KiB |
01_handmade_03.txt |
AC |
222 ms |
5492 KiB |
01_handmade_04.txt |
AC |
214 ms |
5496 KiB |
02_random_00.txt |
AC |
223 ms |
4128 KiB |
02_random_01.txt |
AC |
218 ms |
3548 KiB |
02_random_02.txt |
AC |
225 ms |
5324 KiB |
02_random_03.txt |
AC |
215 ms |
3560 KiB |
02_random_04.txt |
AC |
216 ms |
3552 KiB |
02_random_05.txt |
AC |
224 ms |
5428 KiB |
02_random_06.txt |
AC |
226 ms |
5524 KiB |
02_random_07.txt |
AC |
224 ms |
5356 KiB |
02_random_08.txt |
AC |
224 ms |
5432 KiB |
02_random_09.txt |
AC |
224 ms |
5516 KiB |
02_random_10.txt |
AC |
214 ms |
5464 KiB |
02_random_11.txt |
AC |
214 ms |
5592 KiB |
02_random_12.txt |
AC |
215 ms |
5504 KiB |
02_random_13.txt |
AC |
213 ms |
5528 KiB |
02_random_14.txt |
AC |
214 ms |
5492 KiB |
02_random_15.txt |
AC |
215 ms |
5588 KiB |
02_random_16.txt |
AC |
213 ms |
5360 KiB |
02_random_17.txt |
AC |
213 ms |
5460 KiB |
02_random_18.txt |
AC |
215 ms |
5404 KiB |
02_random_19.txt |
AC |
214 ms |
5548 KiB |
02_random_20.txt |
AC |
220 ms |
5492 KiB |