From 2ea60ba602005eb467e8e39d4a0c75584e6d71a7 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Thu, 21 Nov 2024 23:36:58 +0800 Subject: [PATCH] update --- src/P1002/P1002.cpp | 28 +++++++++++++++++++++++ src/P1176/P1176.cpp | 28 +++++++++++++++++++++++ src/P7077/P7077.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 src/P1002/P1002.cpp create mode 100644 src/P1176/P1176.cpp create mode 100644 src/P7077/P7077.cpp diff --git a/src/P1002/P1002.cpp b/src/P1002/P1002.cpp new file mode 100644 index 0000000..3a78c4c --- /dev/null +++ b/src/P1002/P1002.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +using ll = int64_t; +const ll maxn{ll(20+5)}; +ll mx,my,bx,by; +ll dp[maxn][maxn]; +int main(){ + iostream::sync_with_stdio(0),cin.tie(0),cout.tie(0); + cin>>bx>>by>>mx>>my; + mx+=1; + my+=1; + dp[0][1]=1; + for(ll i{1};i<=bx+1;i++){ + for(ll j{1};j<=by+1;j++){ + if( + (i==mx-1&&(j==my-2||j==my+2))|| + (i==mx-2&&(j==my-1||j==my+1))|| + (i==mx+1&&(j==my-2||j==my+2))|| + (i==mx+2&&(j==my+1||j==my-1)) + ||(i==mx&&j==my) + ){ + continue; + } + dp[i][j]=dp[i-1][j]+dp[i][j-1]; + } + } + cout< +using namespace std; +using ll = int64_t; + +const ll maxn{1000+5},mod{100003}; +ll m,n,dp[maxn][maxn]; +bitset obs[maxn]; + +int main(){ + ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); + cin>>n>>m; + for(ll i{1};i<=m;i++){ + ll x,y; + cin>>x>>y; + obs[x][y]=true; + } + obs[1][1]=true; + dp[1][1]=1; + for(ll i{1};i<=n;i++){ + for(ll j{1};j<=n;j++){ + if(obs[i][j]){ + continue; + } + dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod; + } + } + cout< +using namespace std; +using ll = int64_t; + +const ll maxn{ll(1e5+5)}, mod{998244353}; +ll n,a[maxn],m,t[maxn],p[maxn],v[maxn],q; +vector e[maxn]; + +void dfs(ll const &f){ + if(t[f]==1){ + a[p[f]]=(a[p[f]]+v[f])%mod; + }else if(t[f]==2){ + for(ll j{1};j<=n;j++){ + a[j]=(a[j]*v[f])%mod; + } + }else{ + for(auto const&i:e[f]){ + dfs(i); + } + } +} + +int main(){ + iostream::sync_with_stdio(0),cin.tie(0),cout.tie(0); + cin>>n; + for(ll i{1};i<=n;i++){ + cin>>a[i]; + } + cin>>m; + for(ll i{1};i<=m;i++){ + cin>>t[i]; + if(t[i]==1){ + cin>>p[i]>>v[i]; + }else if(t[i]==2){ + cin>>v[i]; + }else{ + ll c; + cin>>c; + while(c--){ + ll f; + cin>>f; + e[i].emplace_back(f); + } + } + } + cin>>q; + for(ll i{1};i<=q;i++){ + ll f; + cin>>f; + dfs(f); + } + for(ll i{1};i<=n;i++){ + cout<