- 博客(59)
- 收藏
- 关注
原创 Codeforces Round #794 (Div. 2) D. Linguistics
D. Linguistics思路暴力模拟,这题竟然 200020002000 分#include <bits/stdc++.h>using namespace std;#define PB push_backtypedef vector<int> VI;int a, b, c, d;VI res, ab, ba;void work(int num, int f) { if (num & 1) { res.PB(num); }
2022-05-30 10:46:21
286
原创 Codeforces Round #792 (Div. 1 + Div. 2) A ~ E
有空就写思路A - Digit Minimization#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { int n; cin >> n; int mn = 10
2022-05-21 22:03:31
181
原创 Codeforces Round #791 (Div. 2) D. Toss a Coin to Your Graph...
D. Toss a Coin to Your Graph…二分,dfs, toposort, dp#include <bits/stdc++.h>using namespace std;#define PB push_backtypedef long long LL;typedef vector<int> VI;const int N = 2e5 + 10;VI edg[N];int a[N], b[N];int in[N], dp[N];int n, m;L
2022-05-15 16:02:21
362
3
原创 Educational Codeforces Round 128 (Rated for Div. 2) E. Moving Chips
dp预处理:求 minminmin 所以初始化要 INFINFINF状态:dp[i][j]dp[i][j]dp[i][j] 中 iii 表示第 iii 位,jjj 取值 0,10,10,1 表示第 000 行,第 111 行转移方程:分四种情况,见代码#include <bits/stdc++.h>using namespace std;const int N = 2e5 + 10;int dp[N][2];int main() { ios::sync_with_std
2022-05-15 15:58:10
166
原创 Codeforces Round #786 (Div. 3)
I AK div3思路有空就写哈哈哈哈A - Number Transformation#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { int a, b; cin >>
2022-05-03 20:13:26
297
原创 Codeforces Round #783 (Div. 2) A ~ D
有空就写题解A. Direction Change#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { int n, m; cin >> n >> m;
2022-04-20 21:33:36
410
原创 Codeforces Round #782 (Div. 2)
明天有空就写题解A. Red Versus Blue#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { int n, r, b; cin >> n >> r &g
2022-04-18 01:35:12
364
原创 The 16-th Beihang University Collegiate Programming
Link有空就写题解A#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 10;int a[N], b[N];int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i ++ ) cin >> a[i]; for (int i = 1; i <= m; i ++
2022-03-06 21:45:16
271
原创 Codeforces Round #774 (Div. 2) A-D
太菜了,连D都写不出来,补完题目写题解A. Square Counting思路#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { LL n, s; cin >> n >
2022-03-05 01:37:44
359
原创 The 2021 Hangzhou Normal U Summer Trials
Link每天补题就好忙了,没时间写思路QWQ,有时间就写思路A. Aahaxiki’s journey I - set off思路dijkstradijkstradijkstra 算法,没啥说的思路就是拆点,把机场和火车站拆开,建图考虑:起点机场 -> 终点机场起点机场 -> 终点火车起点火车 -> 终点机场起点火车 -> 终点火车特判 n=1n = 1n=1 的时候两次 dijkstradijkstradijkstra 就够用注意,这题会卡常数,必须快
2022-03-01 11:06:30
438
原创 2021 ECNU Campus Invitational Contest
Link思路没写,有空就写思路A. Abstract Algebra#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t -- ) { int a, b, c, d; cin >> a &
2022-02-27 12:55:55
269
原创 Codeforces Round #773 (Div. 2) A~D
有空就写题解A. Hard Way思路签到特判,一条边平行于 y=0y = 0y=0 的直线,且第三个点在该边下方#include <bits/stdc++.h>using namespace std;int main() { int t; cin >> t; while (t -- ) { int x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >&g
2022-02-25 17:44:45
590
原创 Codeforces Round #772 (Div. 2) A - E
没写思路,等我补完E再说吧A. Min Or Sum思路签到#include <bits/stdc++.h>using namespace std;int num[40];int main() { int t; scanf("%d", &t); while (t -- ) { for (int i = 0; i < 30; i ++ ) num[i] = 0; int n; scanf("%d",
2022-02-21 18:57:27
289
8
原创 The 2021 Shanghai Collegiate Programming Contest A,B,C,D,E,G,H,J,K
The 2021 Shanghai Collegiate Programming Contest没写完,今天困了,如果明天起来我还记得我就接着写A. 小 A 的点面论思路垂直向量,高中数学,枚举就好,公式计算挺麻烦的#include <bits/stdc++.h>using namespace std;int main() { int a, b, c, d, e, f; cin >> a >> b >> c >> d
2022-02-21 00:30:37
762
原创 Codeforces Round #771 (Div. 2) A -E
A. Reverse#include <bits/stdc++.h>using namespace std;const int N = 5e3 + 10;int a[N], b[N];int main() { int t; scanf("%d", &t); while (t -- ) { int n; scanf("%d", &n); for (int i = 1; i <= n; i ++
2022-02-15 01:46:52
653
5
原创 Codeforces Global Round 19
A - Sorting Parts思路签到#include <bits/stdc++.h>using namespace std;const int N = 1e4 + 10;int a[N], b[N];int main() { int t; cin >> t; while (t -- ) { int n; cin >> n; for (int i = 1; i <= n; i ++ ) {
2022-02-13 06:10:24
709
3
原创 The 15th Jilin Provincial Collegiate Programming Contest
The 15th Jilin Provincial Collegiate Programming ContestA. Random Number Checker签到#include <bits/stdc++.h>using namespace std;int main() { int n; cin >> n; int odd = 0, even = 0; for (int i = 1; i <= n; i ++ ) {
2022-02-05 17:27:49
2087
原创 Codeforces Round #768 (Div. 2) E. Paint the Middle
E. Paint the Middle#include <bits/stdc++.h>using namespace std;#define FI first#define SE second#define MP make_pair#define PB push_backtypedef pair<int, int> PII;const int N = 2e5 + 10;PII pos[N];vector<PII> seg;vector<PII&
2022-02-04 03:12:28
838
1
原创 Codeforces Global Round 17
A. Anti Light’s Cell GuessingAC(思维)#include <bits/stdc++.h>using namespace std;int main() { int t; scanf("%d", &t); while (t -- ) { int n, m; scanf("%d%d", &n, &m); if (n == 1 && m != 1) cout <<
2021-11-26 16:20:03
355
原创 2013-2014 ACM-ICPC Pacific Northwest Regional Contest
Delta Quadrant思路大体来说就是考虑当去掉 kkk 个点后,所有路径之和加起来乘上 222 就是答案,因为要往返为什么会想到是树形 dpdpdp我们先看数据范围,本来如果是图论,那个 kkk 给的范围是在是很小,同时,这里存在一个最优方案,去除 kkk 个点后最短路,一开始思路可能会歪,但是我们想,这时间复杂度必然爆炸,那么我们再看看,就会想到树形 dpdpdp,时间复杂度也很合适树形 dpdpdp 的状态dp[i][j]dp[i][j]dp[i][j] 的意思是以 iii 点为根
2021-11-23 19:34:46
133
原创 2020 China Collegiate Programming Contest, Weihai Site(施工ing)
C. Rencontre思路总结补题#include <bits/stdc++.h>using namespace std;#define FI first#define SE second#define MP make_pair#define PB push_backtypedef pair<int, int> PII;typedef vector<int> VI;const int N = 2e5 + 10;int cnt[4], num
2021-11-12 21:24:35
583
原创 Codeforces Round #744 (Div. 3)
A. Casimir’s String Solitaire#include <bits/stdc++.h>using namespace std;int main(){ int n; cin >> n; while (n -- ) { string str; int a = 0, b = 0, c = 0; cin >> str; int len = str.size(); for (int i = 0; i < len; i ++
2021-09-29 17:16:54
99
原创 Codeforces Round #317 [AimFund Thanks-Round] (Div. 2)
D. Minimization时间复杂度 O(nlogn+k2)O(nlogn + k ^ 2)O(nlogn+k2)思路我们首先可以想到,最大的情况就是,比如 k==n/2k == n / 2k==n/2 ∑i=1n−k∣A[i]−A[i+k]∣=a[n]−a[1]\sum_{i=1}^{n - k} |A[i] - A[i + k]| = a[n] - a[1]i=1∑n−k∣A[i]−A[i+k]∣=a[n]−a[1]然后我们考虑,我们如何使目标最小,我们想到的就是连着的串就是最小的,那么
2021-09-28 16:58:24
113
原创 Educational Codeforces Round 13
D. Iterated Linear Function思路求 Anx+An−1B+An−2B+.....+AB+BA^{n} x + A ^ {n - 1} B + A ^ {n - 2} B +..... + AB + BAnx+An−1B+An−2B+.....+AB+BAC(number theory)#include <bits/stdc++.h>using namespace std;int main(){ LL a, b, n, x; cin >&g
2021-09-25 18:51:50
82
原创 Codeforces Round #321 (Div. 2)
D. Kefa and DishesAC(ez)#include <bits/stdc++.h>using namespace std;int x[5], y[5];int main(){ int are = 0, cnt = 0, mx = 0; for (int i = 1; i <= 3; i ++ ) { cin >> x[i] >> y[i]; are += x[i] * y[i]; mx = max(mx
2021-09-22 16:15:49
101
原创 Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)
C. Fountains思路三种选法,C+DC + DC+D / D+DD + DD+D / C+CC + CC+CC+DC + DC+D : 两者都要有D+DD + DD+D / C+CC + CC+C : 至少有两个mx[i]mx[i]mx[i] : 在 iii 前最大的 beautifulbeautifulbeautifulcccccc / dddddd : 存储 PIIPIIPII 类型的数据,按照 pricepriceprice 排序细节注释AC(sorting)#in
2021-09-04 12:01:12
115
原创 Codeforces Round #106 (Div. 2)
A. Business tripAC(ez)#include <bits/stdc++.h>using namespace std;int a[20];int main() { int k; cin >> k; for (int i = 1; i <= 12; i ++ ) cin >> a[i]; sort(a + 1, a + 13); int sum = 0; int cnt = 0; for (int i = 13; i >=
2021-08-18 13:56:38
121
原创 2018-2019 ACM-ICPC, NEERC, Southern Subregional Contest, Qualification Stage
I. HeistAC(ez)#include <bits/stdc++.h>using namespace std;const int N = 1e3 + 10;int a[N];int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i ++ ) scanf("%d", a + i); sort(a + 1, a+ 1 + n); LL ans = 0; int pre = a[1]; f
2021-08-18 13:43:50
139
原创 2016-2017 ACM-ICPC, NEERC, Central Subregional Contest.
LINKA. Fried Fish思路注意 n<=kn <= kn<=k 的时候答案是 222AC(ez)#include <bits/stdc++.h>using namespace std;int main(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); int n, k; cin >> n >> k; if (n
2021-08-16 20:32:25
206
原创 Educational Codeforces Round 60 (Rated for Div. 2) 1117
C. Magic Ship思路二分答案,看是否能在 midmidmid 时间内走完全程,能走完就更新 ansansans,不能就接着二分,对于不可能有解的样例,是不可能有更新的就离谱,想到二分了,还是模拟做,离谱dx[i]dx[i]dx[i] 表示的就是在这个时间点上,我在 xxx 上走的距离,每次都要更新,同理 dy[i]dy[i]dy[i]AC(two point)#include <bits/stdc++.h>using namespace std;typedef lo
2021-08-11 17:30:43
84
原创 2021 Shandong Provincial Collegiate Programming Contest
B.Build Roads思路AC(kruskal)#include <bits/stdc++.h>using namespace std;#define PB push_backtypedef long long LL;typedef unsigned long long ULL;const int N = 2e5 + 10;int n, L, R, a[N], p[N] = {0};ULL seed;struct edge{ int u, v, w; bool
2021-08-10 10:42:17
560
原创 Educational Codeforces Round 56 (Rated for Div. 2) 1093
D. Beautiful Graph思路AC(dfs and similar + graphs)#include <bits/stdc++.h>using namespace std;#define PB push_backtypedef long long LL;typedef vector<int> VI;const int mod = 998244353;const int N = 3e5 + 10;VI edge[N];int num[N];in
2021-08-09 10:23:08
87
原创 2020 ICPC Shanghai Site
B. Mine Sweeper II思路AC(math)#include <bits/stdc++.h>using namespace std;#define FI first#define SE second#define MP make_pair#define PB push_back#define rep(i, a, b) for(int i=(a); i<(b); i++)#define per(i, a, b) for(int i=(b)-1; i>=(
2021-08-08 14:35:23
472
原创 ACM International Collegiate Programming Contest, Egyptian Collegiate Programming Contest (ECPC 2015
D. Frozen Rivers思路AC(SPFA + two point)#include <bits/stdc++.h>using namespace std;const LL INF = 0x3f3f3f3f3f3f3f;const int mod = 1e9 + 7;const int N = 1e5 + 10;int h[N], e[N], ne[N], idx;LL tmp[N], dist[N], w[N];bool leaf[N];void add(i
2021-08-06 17:25:40
408
原创 Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
B. Weakened Common Divisor思路AC(math-gcd)#include <bits/stdc++.h>using namespace std;typedef long long LL;LL gcd(LL i, LL j) { return j ? gcd(j, i % j) : i;}LL out(LL n) { for (LL i = 2; i * i <= n; i ++ ) { if (n % i == 0) return i;
2021-08-06 17:19:53
80
原创 The 14th Jilin Provincial Collegiate Programming Contest
LINK签到题就不写了Problem C. String Game思路#include <bits/stdc++.h>using namespace std;const int mod = 1e9 + 7;const int N = 1e3 + 10;int dp[N];int main() { string a, b; while (cin >> a >> b) { memset(dp, 0, sizeof dp); int lena
2021-08-03 20:36:39
427
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人