jaehyunp / stanfordacm Goto Github PK
View Code? Open in Web Editor NEWStanford ACM-ICPC related materials
License: MIT License
Stanford ACM-ICPC related materials
License: MIT License
This repo is really helpful to learn to implement clean algorithms.
It seems like that KMP.cc doesn't handle the case when pattern's length < 2. It is better to fix this problem.
The following code prints 5 3 4
.
int main() {
auto res = LongestIncreasingSubsequence(vector<int>({5,6,2,3,4}));
for (auto i : res)
cout << i << " ";
cout << endl;
}
Hi
I tried the code with the following edge costs:
int cost3[][] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 2, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 2, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 1}, { 0, 0, 0, 0, 0, 0, 0, 0, 0} };
and the following edge capacities:
`int cap3[][] = { { 0, 1, 1, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, INF, 0, 0, INF, 0 },
{ 0, 0, 0, 0, 0, INF, 0, INF, 0 },
{ 0, 0, 0, 0, 0, 0, INF, INF, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, INF },
{ 0, 0, 0, 0, 0, 0, 0, 0, INF },
{ 0, 0, 0, 0, 0, 0, 0, 0, INF },
{ 0, 0, 0, 0, 0, 0, 0, 0, 2 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};`
Your code gave the result 1 2, whereas, I think the result should be 2 2.
I am trying to represent a directed graph here. It is best visualized as an n-partite graph. In the first column, you have node 0, in the second column you have nodes 1, 2 and 3. In the third column, you have nodes 4, 5, 6 and 7. In the last column you have node 8.
Node 0 has edges to nodes 1, 2 and 3 with 0 edge cost and infinite edge capacity. Node 1 has edges to nodes 4 and 7. The edge from 1 to 4 has edge cost 2 and infinite capacity, whereas the edge from 1 to 7 has edge cost 0 and infinite capacity. Node 2 has similar edges to nodes 5 and 7. Node 3 has similar edges to nodes 6 and 7. Nodes 4, 5 and 6 have edges to node 8 with cost 0 and infinite capacity. Node 7 has an edge to node 8 with cost 1 and capacity 2.
Although the Dinic implementation does give the correct result, the time complexity is not right. Issue tracked in TODO as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.