codeforces round sort with
Codeforces Round 870 (A-D)
A $n^2$暴力推,遍历可能撒谎的人数(0-n),然后$O(n)$check就行了。 仔细看逻辑其实$O(1)$就能check,草率了,后面再修正 点击查看代码 #include <bits/stdc++.h> #define rep(i, l, r) for(int i = l; i <= r; ......
CodeTON Round 4 (Div. 1 + Div. 2)C
C. Make It Permutation 我们希望尽可能少地进行操作可以使代价最小,我们如果要排列的话,那些重复的元素我们无论如何都要进行删除的,所以我们可以先把去重的代价计算出来,然后依次枚举排列的位数是多少,也就是枚举去重后的数组,其中的代价我们可以一次计算出来,当我们枚举第i个a时,前面1 ......
Error creating bean with name ‘dataSource‘ defined in class path resource解决办法
原因是导入了jdbc的依赖,使用@Configuration注解向spring注入了dataSource bean。 但是因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。 有两个办法: 办法1: 去除spring-boo ......
codeforces #865 div1A
A. Ian and Array Sorting 思路:首先我们可以从前往后做一遍,把除了最后一个元素其他所有数都变成和第一个数一样的数,然后假如前n-1个数个数为偶数,这样我们分组进行操作,一定可以把所有数变成无限小,也就是说一定会有解,也就是说n为奇数一定有解,我们考虑n为偶数的情况,n为偶数, ......
[Pix2Pix] Image-to-Image Translation with Conditional Adversarial NetWorks
paper:https://arxiv.org/pdf/1611.07004.pdf [CVPR 2017] code: https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix https://phillipi.github.io/pix2pi ......
Competition Set - Codeforces
这里记录的是这个账号的比赛情况。 Codeforces Round 869 (Div. 1) 2023-4-29 Solved:3/6 2302->2350 Good Bye 2022: 2023 is NEAR 2022-12-30 Solved:5/8 2218->2302 Codeforces ......
[CodeForces-545A]题解(C++)
Part I Preface 原题目(Luogu) 原题目(CodeForces) Part II Sketch 给定一个正整数 $n$,表示汽车数量。 给定一个 $n \times n$ 阶矩阵 $A$,第 $i$ 行 $j$ 列上的数字表示 $i$ 车与 $j$ 车的对撞情况。 $\begin{ ......
[CodeForces-545A]题解(C++)
Part I Preface 原题目(Luogu) 原题目(CodeForces) Part II Sketch 给定一个正整数 $n$,表示汽车数量。 给定一个 $n \times n$ 阶矩阵 $A$,第 $i$ 行 $j$ 列上的数字表示 $i$ 车与 $j$ 车的对撞情况。 $\begin{ ......
Educational Codeforces Round 147 (Rated for Div. 2) (贪心)
###原题链接:https://codeforces.com/contest/1821/problem/D * 题意:从1开始走,走的给定区间的值要k次。且shift按了要松开,代表走了一个区间除了往右的次数,还要多两次按shift的次数, 求最小次数。 * 思路: 1. 先把不可能的情况列出来,就 ......
Graph Convolutional Networks with EigenPooling
Ma Y., Wang S., Aggarwal C. C. and Tang J. Graph convolutional networks with eigenpooling. KDD, 2019. 概 本文提出了一种新的框架, 在前向的过程中, 可以逐步将相似的 nodes 和他们的特征聚合在 ......
Image Captioning with nlbconnect/vit-gpt2-image-captioning
https://huggingface.co/nlpconnect/vit-gpt2-image-captioning The Illustrated Image Captioning using transformers Image captioning is the process of gen ......
Codeforces Round 869 (Div. 2)
从这一篇开始,比较重要的题目我会把题面放上 A. Politics 傻逼题目,傻逼题面,傻逼出题人 明明一句话能说清楚的事情为啥放样例了说啊? 不然你说这个东西有多项式解法吗? 一句话题解,和我不同意见的,都得死 #include <bits/stdc++.h> #define ll long lo ......
Codeforces Round 867 (Div. 3)
A. TubeTube Feed 分析: 从所有a[i]+i-1<=t的选择种取个max即可 code: #include <bits/stdc++.h> using namespace std; const int N = 55; int a[N], b[N]; int main() { std: ......
Codeforces 908H - New Year and Boolean Bridges(FWT)
一道挺有意思的题,并且感觉有点诈骗的成分在内( 首先考虑分析三种字符的性质: 显然任意两点 $i,j$ 之间要么 $i$ 可以到达 $j$,要么 $j$ 可以到达 $i$,否则 A O X 三个一个都不能满足。 如果两点间的状态是 A,那么这两点必须在同一强连通分量内。 如果两点间的状态是 X,那么 ......
SMU Spring 2023 Trial Contest Round 10
A. Remove Duplicates #include <bits/stdc++.h> //#define inf 0x3f3f3f3f #define endl '\n' #define int long long using namespace std; const int N = 2e3 ......
CQ 周赛 Round#1
题目见此 F. 树染色方案计数 一道很有意思的树形 dp,和 P4516 潜入行动 非常相似。 考虑状态怎么定义。第一个维度肯定是以 $i$ 为根的子树,第二个维度是当前子树中的特殊节点个数,同时还要考虑当前节点的颜色,即为第三个维度。 当前节点的颜色无非跟 $k$ 有关,即小于 $k$,等于 $k ......
Uncaught Error: Objects are not valid as a React child (found: object with keys {content, key, duration}). If you meant to render a collection of children, use an array instead(转)
转自:react报错 Uncaught Error: Objects are not valid as a React child (found: object with keys {a} ... 报错信息分析 Uncaught Error: Objects are not valid as a R ......
C++黑马程序员——P251-254. 常用排序算法 sort,random_shuffle,merge,reverse
P251. 常用排序算法——sort P252. ...——random_shuffle P253. ...——merge P254. ...——reverse P251. sort 1 #include <iostream> 2 #include <vector> 3 #include <algo ......
[Docker] Add a SQLite Console Shortcut with the Dockerfile
With a long-running node server and a database, sometimes it's useful to ssh into the virtual machine to explore the file system, and look at the data ......
4.[1201D - Treasure Hunting](https://codeforces.com/problemset/problem/1201/D)
4.1201D - Treasure Hunting 题目意思: 在一个n*m的地图上面,左下角的坐标是(1,1),最开始你位于左下角,一秒钟你可以进行往左或者往右的操作,你只能在一些特殊的列上面进行往上移动的操作,你不可以往下移动。现在告诉你k个宝藏的坐标信息以及哪些列是允许往上的,问最后至少要几 ......
Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)
好久没发博客了,发一篇。 A 求出每个 $0$ 与往前 / 往后最近的 $1$ 的距离即可。 时间复杂度 $\mathcal{O}(n)$。 B $(x, y) \to (x + y, y) \to (x + y, -x) \to (y, -x) \to (y - x, -x) \to (y - x ......
SMU Spring 2023 Contest Round 1
SMU Spring 2023 Contest Round 1 B - Contest Preparation 思路:特判下m大于n的情况,只有make后才能validate #include<bits/stdc++.h> using namespace std; typedef pair<int, ......
SSH工具远程登录Linux系统错误解决方法,错误提示Disconnected:No supported authentication methods available(server sent:publickey,gssapi-keyex,gssapi-with-mic)解决办法
一、使用轻量云控制面板的登录,sudo su获取root账号权限; 二、执行passwd命令,输入新密码来修改root密码。 三、修改密码登录为yes,步骤如下 1、运行命令 vi /etc/ssh/sshd_config 2、将参数PasswordAuthentication设置为yes,前面不能 ......
Codeforces Round 869 (Div. 2) A-D题解
比赛地址 A. Politics 题意:有n个人对m个决案进行投票,对于每一个决案如果票数相同则所有人都离场,反之票数少的一方离场,现在提前知道了每个人的意见,让一些人参与投票,在保证第一个人不离场的情况下最终剩余人数最多是多少 Solution 把和第一个意见不同的给去掉就行了 void solv ......
sort快排
#include<bits/stdc++.h> using namespace std; int n; long long a[100010]; bool b,px[100010]; void jh(int x,int y) { int az=a[y]; a[y]=a[x]; a[x]=az; } ......
Codeforces 914H - Ember and Storm's Tree Game(计数)
我这个低能儿怎么这个题调了这么久啊,废了/dk 非常烦的做法,不过也可以看看,代码也不算太难写( 首先注意到很诈骗的一件事情是,只要这个序列 $a$ 是单峰的或者单谷的(当然,递增递减序列也算在内),都恰有两种方式选择 $(i,op)$ 使得操作完后的序列的单调的,并且显然选树的 Ember 有必胜 ......
Chemistry Experiment Codeforces Round 247 (Div. 2) 线段树动态开点,二分
第一次写的时候还不会线段树的动态开点,写了一个是线段树但是是$O(N^2)$的写法,现在用动态开点武装了自己,会了正解$O(qlog n^2)$。首先建立一个权值线段树,但这里的权值很大,通过动态开点去建树来节省空间,对于两种操作: 操作1,常见的动态开点的单点修改 操作2,二分答案,然后在线段树上 ......
Linux shell command ls sort by date All In One
Linux shell command ls sort by date All In One
ls 按时间排序,最新的排在最前面
$ ls -t
$ ls --time
# reverse
$ ls -tr
......
Codeforces 280C Game on Tree
设 $p_i$ 为 $i$ 涂色或不涂色,$1$ 为涂,$0$ 为不涂,答案即为 $E[\sum_{i = 1}^n p_i]$ 然后转化一下柿子:$\sum_{i=1}^nE[p_i]$,这就很好求了,单独求每个点 $E[p_i]$ 的值就行了 考虑对于 $u$ 点,$p_u = 1$,即能被涂需 ......
Educational Codeforces Round 147 (Rated for Div. 2) A~E 题解
A Link。 模拟,代码。 B Link。 模拟,代码。 C Link。 我们设 $c$ 为最后相同的字符。 性质:我们一定不会删除字符 $c$。 因此以 $c$ 为最后字符的操作次数就是不包含字符 $c$ 的极大段的最小操作次数的最大值。 对于一个长度为 $l(l\ge 1)$ 的段,它的最小操 ......