自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(57)
  • 收藏
  • 关注

原创 暂存软工作业

作业

2022-09-18 19:05:26 604 1

原创 明天补题方便找

补题

2022-07-28 00:57:32 144

原创 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 231

原创 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 119

原创 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 288 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 140

原创 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 266

原创 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 385

原创 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 334

原创 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 230

原创 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 &gt

2022-03-05 01:37:44 293

原创 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 368

原创 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 237

原创 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 546

原创 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 205 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 639

原创 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 559 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 643 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 1976

原创 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 755 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 <&lt

2021-11-26 16:20:03 321

原创 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 91

原创 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 505

原创 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 71

原创 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 79

原创 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 55

原创 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 70

原创 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 82

原创 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 86

原创 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 108

原创 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 164

原创 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 53

原创 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 480

原创 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 58

原创 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 413

原创 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 336

原创 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 46

原创 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 363

原创 The 2021 Sichuan Provincial Collegiate Programming Contest

L. Spicy Restaurant参考博客时间复杂度O(100∗(n+m))O(100 * (n + m) )O(100∗(n+m))思路w[i]<100w[i] < 100w[i]<100提示一开始我的思路是在考虑要不要就直接每个点 bfsbfsbfs,算了一下复杂度是 O(100n2)O(100n ^ 2)O(100n2),显然不对,所以就否定了该想法那么考虑多源 bfsbfsbfs ,时间复杂度就可以降低到 O(100(n+m))O(100(n + m))O(10

2021-08-02 20:00:51 374

原创 Codeforces Global Round 14

C. Phoenix and Towers思路显然,这个 towertowertower 一定成立.1.我们可以这样子想,把 nnn 个 blocksblocksblocks 平均分成 mmm 个,如果整除,皆大欢喜,肯定有一种可以使他们的差小于 xxx,如果不能整除,没有关系,我们仍然可以把他看成是先分成 mmm 个数量一样的 towertowertower 然后再加上余数,这样子,仍然可以.2.我们还可以这样子想,内一次都是给 highthighthight 最小的 towertowertow

2021-07-29 16:36:55 41

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除