The recursion is obvious ... But if you want to do matrix multiplication, you have to split the points .. At first, I was very confused about every weight v>1 All sides are new v-1 There are two nodes to transfer ... And then TLE 了 ... Break each point into 9 Just one ... Time complexity O((9N)^3*logT)
1297: [SCOI2009] Get lost
【 Enter example 2 】
【 Examples explain one 】
【 Output sample 2 】
30% The data of , Satisfy 2 <= N <= 5 ; 1 <= T <= 30 .
100% The data of , Satisfy 2 <= N <= 10 ; 1 <= T <= 1000000000 .
- 【BZOJ1297】[SCOI2009] Get lost （ Matrix fast power ）
[BZOJ1297][SCOI2009] Get lost ( Matrix fast power ) Topic BZOJ Luogu Answer key Because the biggest edge weight is \(9\), So the record goes forward \(9\) Unit time ago . Just the number of solutions to each point , So the matrix size is \ ...
- 2018.10.23 bzoj1297: [SCOI2009] Get lost （ Matrix fast power optimization dp）
Portal Matrix fast power optimization dp Simple questions . Consider the state transfer equation : f[time][u]=∑f[time−1][v]f[time][u]=\sum f[time-1][v]f[time][u]=∑f[time−1 ...
- 【BZOJ】2004: [Hnoi2010]Bus Bus lines Pressure DP+ Matrix fast power
[ The question ]n The points are equidistant in length n-1 In a straight line , Starting point 1~k There's a bus , Every bus needs some stops , Each point can only be stopped by one bus at most , And the distance between two adjacent stops of each bus is at most p, All the buses will stop at n-k+1~n ...
- 【BZOJ】4861: [Beijing2017] Magic spell AC automata +DP+ Matrix fast power
[ The question ] Given n Two original strings and m A taboo string , It is required to use the original string set to spell the string without taboo and the length is L The number of strings .(60%)n,m<=50,L<=100.(40%) The length of the original string is 1 or 2,L<=10^18. [ Algorithm ...
- bnuoj 34985 Elegant String DP+ Matrix fast power
Topic link :http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=34985 We define a kind of strings as elegant s ...
- HDU 5434 Peace small elephant Pressure dp+ Matrix fast power
Topic link : http://acm.hdu.edu.cn/showproblem.php?pid=5434 Peace small elephant Accepts: 38 Submissions: ...
- BZOJ5298 CQOI2018 Staggered sequence 【DP+ Matrix fast power optimization 】*
BZOJ5298 CQOI2018 Staggered sequence [DP+ Matrix fast power optimization ] Description We call it just by 0.1 The sequence of composition is " Staggered sequence ", If and only if there is no adjacent 1( There can be adjacency ...
- Codeforces 621E Wet Shark and Block【dp + Matrix fast power 】
The question : Yes b individual blocks, Every blocks There are n A the same 0~9 The number of , If from the first block choose 1, From the second block choose 2, So it's made up of 12, Ask for a given n,b How many kinds of composition schemes make the final mold x The remainder is k. branch ...
- codeforces E. Okabe and El Psy Kongroo（dp+ Matrix fast power ）
Topic link :http://codeforces.com/contest/821/problem/E The question : We are now in (0,0) It's about , The goal is to go to (K,0) It's about . Every time we can get from (x,y) Go to the (x+1,y- ...
- EF framework ~ stay T4 Custom attributes in template getter and setter
Back to directory T4 Template for us in ORM Convenient operation is provided , It is very convenient to modify the entity globally , I introduced it before T4 To add default to attributes , And today I'm going to tell you how to use T4 The template will getter,setter Change the block to yourself ...
- cmd Open the control panel and other commands
If you're on the machine of a domain user with less privileges , To do some management operations , It's inevitable to use cmd Open some programs that can only be opened in the graphical interface before . Here are some common operations I collected . Start the program in some capacity :runas /user:it\n1 ...
- C The preparation before basic language learning -1
C Language Overview Welcome to C The world of !C The name of language is C, Because C Language comes from Ken Thompson Invented B Language . It's a portable language , Usually a C Programs can run on other systems with little or no changes : It's powerful ...
- Node.js Learning starts
- establish .ignore file
Method 1 :1. When you need to create .gitignore File folder , The right choice Git Bash Go to the command line , Enter the project directory . Such as :(cd /d/git/project) 2. Input touch .gitig ...
- Cron Expression details （ It has been sorted out 、 Very clear ）
Cron An expression is a string , String is divided into 6 or 7 Domains , Each domain represents a meaning ,Cron There are two grammatical formats as follows : Seconds Minutes Hours DayofMonth Month DayofWeek ...
- BZOJ 4610: [Wf2016]Ceiling Functi Water problem
4610: [Wf2016]Ceiling Functi Topic linking : http://www.lydsy.com/JudgeOnline/problem.php?id=4610 Description ...
- opencv load modify preservation Images
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; /* 1 Load image cv::imre ...
- ubuntu The structures, openGL Environmental Science
1. Build a basic compilation environment sudo apt-get install build-essential 2. install OpenGL Library sudo apt-get install ...
1. Event Bubbling Microsoft came up with an event stream called event bubble . Bubbling can be likened to throwing a stone into the water , Bubbles will come out of the water all the time . in other words , Events start with the innermost elements , All the way up , until document object . because ...