Submission #72909785
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define srep(i,l,r) for(ll i=l;i<=r;i++)
#define irep(i,r,l) for(ll i=r;i>=l;i--)
using ll = long long;
using ld = long double;
const ll mod=998244353;
#define vout(v) for(auto i :v) cout<<i<<" "; cout<<"\n";
#define INF 9223300000000000000ll
#define Winf 5e12
#define nl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vl vector<ll>
#define pb push_back
#define vc vector<char>
#define vb vector<bool>
#define uniq(x) sort((x).begin(),(x).end());(x).erase(unique((x).begin(),(x).end()),(x).end())
#define eb emplace_back
void no(void) { cout<<"No"<<nl;}
void yes(void) {cout<<"Yes"<<nl;}
void yn(bool a) {
cout<<(a ? "Yes":"No")<<nl;
}
vector<ll> dx={-1,0,1,0,1,1,-1,-1};
vector<ll> dy={0,-1,0,1,-1,1,-1,1};
bool isin(ll i,ll j,ll h,ll w) {
if(i<0 || i>=h || j<0 || j>=w) return false;
return true;
}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<class T>T vecmax(const vector<T>&v){return *max_element(all(v));}
template<class T>T vecmin(const vector<T>&v){return *min_element(all(v));}
ll safemod(ll num,ll rule) {
return (num%rule+rule)%rule;
}
ll sum(vector<ll> &a) {
return accumulate(all(a),0ll);
}
template<class T>void vvpr(vector<vector<T>> g) {
rep(i,g.size()) {
rep(j,g[i].size()) {
cout<<g[i][j]<<(j==g[i].size()-1 ? "\n":" ");
}
}
}
int main() {
ll t; cin>>t;
while(t--) {
ll n,c; cin>>n>>c;
vector<vc> g(n,vc(n));
rep(i,n) rep(j,n) {
char ch; cin>>ch;
g[i][j]=ch;
}
vector<vl> cab(n,vl(n));
rep(j,n) {
bool bl=true;
irep(i,n-1,0) {
if(g[i][j]=='#') {
cab[i][j]=bl;
bl=0;
}
else cab[i][j]=bl;
}
}
vector<vl> dp(n,vl(n));
dp[n-1][c-1]=1;
vl d={-1,0,1};
irep(i,n-1,1) {
rep(j,n) {
if(!dp[i][j]) continue;
rep(k,3) {
ll nj=j+d[k];
if(!(0<=nj && nj<n)) continue;
if(g[i-1][nj]=='.') dp[i-1][nj]=true;
else {
if(cab[i-1][nj]) {
dp[i-1][nj]=true;
ll di=2;
while(i-di>=0) {
cab[i-di][nj]=1;
if(g[i-di][nj]=='#') break;
di++;
}
}
}
}
}
}
string ans="";
rep(i,n) {
if(dp[0][i]) ans+='1';
else ans+='0';
}
cout<<ans<<nl;
}
}
Submission Info
| Submission Time |
|
| Task |
E - Climbing Silver |
| User |
Leal_al |
| Language |
C++23 (GCC 15.2.0) |
| Score |
450 |
| Code Size |
3107 Byte |
| Status |
AC |
| Exec Time |
411 ms |
| Memory |
153156 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
450 / 450 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt |
| All |
sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt |
| Case Name |
Status |
Exec Time |
Memory |
| sample_01.txt |
AC |
1 ms |
3424 KiB |
| test_01.txt |
AC |
43 ms |
3640 KiB |
| test_02.txt |
AC |
54 ms |
3516 KiB |
| test_03.txt |
AC |
69 ms |
3576 KiB |
| test_04.txt |
AC |
86 ms |
3568 KiB |
| test_05.txt |
AC |
110 ms |
3584 KiB |
| test_06.txt |
AC |
134 ms |
3568 KiB |
| test_07.txt |
AC |
160 ms |
3640 KiB |
| test_08.txt |
AC |
189 ms |
3640 KiB |
| test_09.txt |
AC |
223 ms |
3544 KiB |
| test_10.txt |
AC |
256 ms |
3544 KiB |
| test_11.txt |
AC |
296 ms |
3608 KiB |
| test_12.txt |
AC |
335 ms |
3592 KiB |
| test_13.txt |
AC |
346 ms |
3576 KiB |
| test_14.txt |
AC |
300 ms |
3568 KiB |
| test_15.txt |
AC |
249 ms |
5104 KiB |
| test_16.txt |
AC |
248 ms |
5120 KiB |
| test_17.txt |
AC |
346 ms |
153052 KiB |
| test_18.txt |
AC |
372 ms |
153040 KiB |
| test_19.txt |
AC |
379 ms |
153152 KiB |
| test_20.txt |
AC |
345 ms |
153072 KiB |
| test_21.txt |
AC |
368 ms |
153028 KiB |
| test_22.txt |
AC |
357 ms |
153148 KiB |
| test_23.txt |
AC |
356 ms |
153052 KiB |
| test_24.txt |
AC |
345 ms |
153040 KiB |
| test_25.txt |
AC |
346 ms |
153016 KiB |
| test_26.txt |
AC |
347 ms |
153032 KiB |
| test_27.txt |
AC |
399 ms |
153072 KiB |
| test_28.txt |
AC |
375 ms |
152972 KiB |
| test_29.txt |
AC |
380 ms |
153048 KiB |
| test_30.txt |
AC |
373 ms |
153156 KiB |
| test_31.txt |
AC |
374 ms |
153024 KiB |
| test_32.txt |
AC |
365 ms |
153048 KiB |
| test_33.txt |
AC |
368 ms |
153040 KiB |
| test_34.txt |
AC |
355 ms |
153072 KiB |
| test_35.txt |
AC |
370 ms |
153040 KiB |
| test_36.txt |
AC |
411 ms |
153148 KiB |
| test_37.txt |
AC |
388 ms |
153024 KiB |
| test_38.txt |
AC |
368 ms |
153052 KiB |
| test_39.txt |
AC |
368 ms |
153024 KiB |
| test_40.txt |
AC |
373 ms |
152916 KiB |
| test_41.txt |
AC |
382 ms |
153032 KiB |
| test_42.txt |
AC |
345 ms |
153028 KiB |
| test_43.txt |
AC |
377 ms |
153028 KiB |
| test_44.txt |
AC |
348 ms |
153148 KiB |
| test_45.txt |
AC |
374 ms |
153148 KiB |
| test_46.txt |
AC |
347 ms |
153152 KiB |
| test_47.txt |
AC |
348 ms |
153148 KiB |