摘要: codeforces 3. Limited Repainting const int maxn = 3e5+10; int n, k, a[maxn]; string s; bool check(int mx){ int len = 0, cnt = 0; bool not_need = true; 阅读全文
posted @ 2025-02-28 11:09 Devpp 阅读(38) 评论(0) 推荐(0)
摘要: Codeforces 1. Swap Columns and Find a Path #define int long long void solve(){ int n; cin >> n; int a[2][n+2], cnt = 0; a[0][0] = a[1][0] = a[0][n+1] 阅读全文
posted @ 2025-02-27 16:35 Devpp 阅读(10) 评论(0) 推荐(0)
摘要: Codeforces Round 1006 (Div. 3) 1. New World, New Me, New Array int n, k, p; void solve(){ cin >> n >> k >> p; if((k>0 && n*p < k )|| (k<0 && -n*p > k) 阅读全文
posted @ 2025-02-26 09:19 Devpp 阅读(36) 评论(0) 推荐(0)
摘要: AtCoder 1. Paint to make a rectangle void solve(){ int h, w; cin >> h >> w; string a[h]; for(int i=0; i<h; i++) cin >> a[i]; int mxx = 0, mxy = 0, mnx 阅读全文
posted @ 2025-02-25 08:19 Devpp 阅读(8) 评论(0) 推荐(0)
摘要: 爆学数据库的一天 Codeforces 1. Shashlik Cooking void solve(){ int n, k; cin >> n >> k; int len = 2*k+1; if(n % len <= k && n%len != 0){ cout << n/len+1 << end 阅读全文
posted @ 2025-02-24 22:40 Devpp 阅读(12) 评论(0) 推荐(0)
摘要: Codeforces Round 1005 (Div. 2) 1. Brogramming Contest void solve(){ int len; cin >> len; string s; cin >> s; s = '0'+s; len += 2; int cnt = 0; for(int 阅读全文
posted @ 2025-02-23 11:07 Devpp 阅读(19) 评论(0) 推荐(0)
摘要: 1. Is It A Tree?-树,并查集 题意 给定多条有向边的图,问这个图是不是一个树 思路 有两种思路 一种是用邻接表构建这个图,然后以入度为 0 的点为根,遍历这个图 如果入度为 0 的点有多个,或者在遍历的时候访问到了已经访问过的点,则不是一棵树 另一种思路就是用并查集 如果合并的时候两 阅读全文
posted @ 2025-02-22 21:52 Devpp 阅读(12) 评论(0) 推荐(0)