using namespace std; using ll = long long; using VI = vector<ll>; using PII = pair<ll, ll>; const ll maxn = 2e5+5; const ll mx = 2e4+2; const ll pian = 1e4+20; const ll mod = 998244353; int fx[1003][maxn],fy[1003][maxn], a[maxn]; int x, y, n; int m =...
依题意建树即可。 defsolve():n=II()nums=LII()adj=defaultdict(list)foriinrange(n):adj[nums[i]].append((i+1)<<1)adj[nums[i]].append((i+1)<<1|1)q=deque()d=[0for_inrange(2*n+2)]step=0q.append(1)whileq:k=len(q)for_inrange(k):cur=q.popleft()d[cur]=stepforeinadj[...
给定一个数组,不改变原顺序,输出是偶数的数。 解题思路 模拟即可。 神奇的代码 #include<bits/stdc++.h> usingnamespacestd; usingLL =longlong; intmain(void){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); intn; cin >> n; while(n--){ intx; cin >> x; if(!(x &1)) co...
vector<ll>q[N]; unordered_map<ll,ll>l,r; ll cnt1,cnt2; signed main(){ ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); ll bx,by; cin>>n>>m>>bx>>by; ll t;cin>>t;while(t--){ ll x,y;cin>>x>>y;if(!l[x]) l[x]=++cnt1;//类似于离散化的操作if(!r[y]...
AtCoder Beginner Contest 273的C题是否需要使用动态规划来解决? A - A Recursive Function Origional Link 题目大意: 求f(k) 如下: f(0)=1; f(k)=k×f(k−1) 思想: 签到题。 代码: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #include <iostream> #include <cstring> #include <cstdio...
23.3.6打卡 AtCoder Beginner Contest 277 A~D https://blog.csdn.net/Tanya_xiaomai/article/details/129361476 AtCoder Beginner Contest 277 (1182th place) screencast https://www.bilibili.com/video/BV1dd4y1F7eq/ AtCoder Beginner Contest 277 D Takahashi's Solitaire ...
AtCoder Beginner Contest 272的C题难度如何,一般需要多长时间解决? A. Integer Sum Origional Link 题目大意: N 个数求和。 思想: 签到题。 代码: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <cmath> #in...
AtCoder Beginner Contest 272 F - Two Strings(后缀数组) https://blog.csdn.net/qq_45377553/article/details/127231891 https://blog.csdn.net/qq_53282173/article/details/127226225 AtCoder Beginner Contest 272「A」「B」「C」「D bfs」「E 思维」 ...
AtCoder Beginner Contest 042题解(ABCD) AtCoder Beginner Contest 042题解(ABCD) 传送门 A - Iroha and Haiku (ABC Edition) 签到题,直接判断是否是两个 5 5 5,一个 7 7 7。 #include<bits/stdc++.h> using namespace std;
AtCoder Beginner Contest 042题解(ABCD) 传送门 A - Iroha and Haiku (ABC Edition) 签到题,直接判断是否是两个5 55,一个7 77。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;...