题意:找三条同起点同终点的不相交的路径 题解:用tarjan的思想,记录两个low表示最小和次小的dfs序,以及最小和次小的位置,如果次小的dfs序比dfn小,那么说明有两条返祖边,那么就是满足条件的答案 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) //#pragma GCC optimize("unroll-loops") //#pragma comment(linker,…
目录 2018-2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) A.Find a Number(BFS) C.Cloud Computing(线段树) D.Garbage Disposal(模拟) E.Getting Deals Done(二分) F.Debate(贪心) H.BerOS File Suggestion(后缀自动机) I.Privatization of Roads in Berland(网络流)…
2018-2019 ICPC, NEERC, Southern Subregional Contest 闲谈: 被操哥和男神带飞的一场ACM,第一把做了这么多题,荣幸成为7题队,虽然比赛的时候频频出锅,差点被鸽,但还算打完了5h 总的来说这场还是不算难的,7题还是少了点 A 题目: 给出a,b,求出一个数满足是a的倍数,且数字和为b 题解: 男神懒得写博客就甩锅了 直接宽搜,宽搜时队列中的状态保存为x,y,x表示当前的数%a==x,y表示数字和 然后记录状态和方案就行了 参考代码: #inclu…
2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D Problem D. Distribution in Metagonia Input file: distribution.in Output file: distribution.out Time limit: 2 seconds Memory limit: 256 megabytes There are one hundred noble families in the cou…
Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 512 megabytes Many of you may have been to St. Petersburg, but have you visited Peterhof Palace? It is a collection of splendid pa…
Problem D. Delay Time Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 512 megabytes Petr and Egor are measuring the gravitational acceleration g on their physics lessons using a special device. An electromag…
2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest 2019年10月11日 15:35-20:35(Solved 8,Penalty 675) 这两天好像回寝室太早了,导致早早地就躺在床上吸引蚊子.到睡觉的点的时候,蚊子们就已经嗷嗷待哺地聚集到了我的床边.凌晨2:00~4:00的时候被烦得,只能下床喷个六神+开个空调QwQ.早上起不来导致很多东西都咕咕咕了(比如今日中午的市中心觅食计划). 以后不出意外的话,我们队应该每周三&周六的这个…
$$2015-2016\ ACM-ICPC,\ NEERC,\ Northern\ Subregional\ Contest$$ \(A.Alex\ Origami\ Squares\) 签到 //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; int main(){ int a,b; freopen("alex…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 "max" "min" "+" "-" "" "/"对随机数 "?" 进行处理,使最后式子得到c的概率超过1/2 (所有数字均在0~255之间,"+" "…
i207M的“怕不是一个小时就要弃疗的flag”并没有生效,这次居然写到了最后,好评=.= 然而可能是退役前和i207M的最后一场比赛了TAT 不过打得真的好爽啊QAQ 最终结果: 看见那几个罚时没,全是我贡献的,还全是睿智的细节错误(逃 不罚时估计就进前100了啊QAQ,我好菜啊.jpg 我切了3道(然后挂了四次2333,i207M切了4道(orz),具体比赛历程太长了,不好写,就在题上写吧=.= A.Find a Number 开场不到十分钟就有神仙切了这神仙题 因为种种原因,这题到吃晚饭的…
从这里开始 题目列表 瞎扯 Problem A Find a Number Problem B Berkomnadzor Problem C Cloud Computing Problem D Garbage Disposal Problem E Getting Deals Done Problem F Debate Problem G Monsters and Potions Problem H BerOS File Suggestion Problem I Privatization of…
第一次打ACM比赛,和yyf两个人一起搞事情 感觉被两个学长队暴打的好惨啊 然后我一直做傻子题,yyf一直在切神仙题 然后放一波题解(部分) A. Find a Number LINK 题目大意 给你d和s,求你一个最小的数满足是d的倍数且数字和是s 思路 从高位到低位考虑广搜,把当前的长度和模d的余数作为状态,然后添加一个数就在对应的位置上加 一个模数只记录长度最小的状态,然后可以反着贪心回去 yyf的神仙code: #include <iostream> #include <cstd…
秉承ACM团队合作的思想懒,这篇blog只有部分题解,剩余的请前往星感大神Star_Feel的blog食用(表示男神汉克斯更懒不屑于写我们分别代写了下...) C. Cloud Computing 扫描线搞一搞区间(主席树也OK啊,只是空间玄学,主席树理论空间nlogn实际上开小那么10倍8倍没什么锅啊zzzz),对于权值建立权值线段树,然后记录每个权值出现的次数以及区间权值和,然后在线段树上二分求答案即. #include<cstdio> #include<cstring> #i…
A. Anniversary Cake 随便挑两个点切掉就好了. #include<bits/stdc++.h> using namespace std; const int Maxn=200020; typedef long long LL; typedef pair<int,int>pi; pi a[2]; int main() { freopen("anniversary.in","r",stdin); freopen("an…
这种题目最重要的是思路了清晰 #include <cstdio> #include <cstring> ;//sqrt(n)+1 is enough ][]; ]; int a[maxn]; void factor(int m) { ][]; num = ; ; i*i <= m; i++) { ) { fac[++num][] = i; fac[num][] = ; do { fac[num][]++; m/= i; } ); } } ) { fac[++num][] =…
K. King's Rout time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output The great rout will be held this evening in the palace of his majesty Nassah II, the king of Occorom. There are n guests invi…
I. Illegal or Not? time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output The Schengen Agreement was signed by a number of countries to uniform many visa-related questions and to allow tourists fr…
H. Hashing time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output In this problem you are given a byte array a. What you are going to do is to hash its subsequences. Fortunately you don't have to…
C. Colder-Hotter time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output This is an interactive problem. Egor and Petr are playing a game called «Colder-Hotter» on a 2D plane. At the beginning of t…
A. Anagrams time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Consider the positional numeral system with a given base b. A positive integer x is called b-anagram of a positive integer y if t…
A. Find a Number 找到一个树,可以被d整除,且数字和为s 记忆化搜索 static class S{ int mod,s; String str; public S(int mod, int s, String str) { this.mod = mod; this.s = s; this.str = str; } } public static void main(String[] args) { IO io = new IO(); int[][]vis=new int[550…
A. Auxiliary Project 完全背包. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue>…
题目链接:https://codeforces.com/contest/1089/problem/E Elma is learning chess figures. She learned that a rook can move either horizontally or vertically. To enhance her understanding of rook movement Elma’s grandmother gave Elma an 8 × 8 chess board and…
题目链接:https://codeforces.com/contest/1089/problem/K time limit per test: 2 seconds memory limit per test: 512 megabytes King Kog got annoyed of the usual laxity of his knights — they can break into his hall without prior notice! Thus, the King decided…
A. Find a Number Solved By 2017212212083 题意:$找一个最小的n使得n % d == 0 并且 n 的每一位数字加起来之和为s$ 思路: 定义一个二元组$<d, s>$ 表示当前状态模d的值,以及每一位加起来的值 跑最短路,从$<0, 0>  跑到 <0, s>$ #include<bits/stdc++.h> using namespace std; ; const int INF = 0x3f3f3f3f; #de…
A. Alice the Fan Solved. 题意: 两个人打网球,要求teamA 的得分与其他队伍拉开尽量大 输出合法的方案 思路: $dp[i][j][k][l] 表示 A 赢i局,其他队伍赢j局,两个人比分为k : l 的时候的方案$ #include<bits/stdc++.h> using namespace std; ][][][]; vector<pair<][][][]; void Init() { dp[][][][] = ; ; sum <= ; ++…
下午连着两场比赛,爽. 首先是codeforses,我和一位dalao一起打的,结果考炸了,幸亏不计rating.. A Alice the Fan 这个就是记忆化搜索一下预处理,然后直接回答询问好了,我肯定是傻逼了,还写了这么长,幸亏调处来了. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<vector> using namespa…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:1s 空间限制:512MB 题目大意: 给定一个字符串,使用%[...]形式将字符串中出现的字符整理到最短和最小(ASCII范围为32~126),可使用的字符有 '-' '^' 题目解法:模拟整理正的和使用 '^' 取反的两个字符串,输出较短较小的那个(注意当所有字符都存在时,输出%[^!]最小) 样例: 代码: #include <algorithm> #inclu…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个凸多边形,有一种连接两个顶点可以将多边形分成两个非空的面积为整数的图形,询问这种线有多少条. 数据范围: 4 ≤ n ≤ 200 000 −109 ≤ xi, yi ≤ 109 样例: 代码: #include <algorithm> #include <iostream> #include <cstr…
题目描述: 解题思路: 输入时提出单个字符串,并用一个数组记录每列最长长度,格式化输出 #include <iostream> #include <algorithm> #include <string> #include <sstream> #include <vector> using namespace std; vector<] ; ] ; int main(int argc, char *argv[]) { string buf,…