Comments (6)
@SamZhangQingChuan how does your solution to O work? :)
I don't remember clearly. Looks like work out all the reachable states first and then do gaussian elimination.
from nzpc-2018.
Hi, thanks, I'll have a closer look at that.
"tried to go backwards"? What's TLE? (Edit: oh, time limit exceeded)
The trick for K is to decompose vertical and horizontal folds, handling them separately and then multiplying. For example if at a certain position the foil has been folded over 5 times when only folds along a horizontal axis are considered, and 3 times when only vertical folds are considered, that's a thickness of 15.
My solution for K stores the thickness of the foil as a list of thickness-length segments, like 5cm of thickness 2, 2cm of thickness 1. That's stored as [[2,5],[1,2]] in the R and C variables. Processing a fold then just requires splitting this list of segments in half (possibly splitting one segment) and combining the halves. Simple in theory, but easy to make off-by-one mistakes.
from nzpc-2018.
Also, in fold()
in K.py, R1 and R2 are the two halves of the segment list, and when I iterate past the end of R1 or R2 I treat it as a virtual segment of length 1e9 thickness 0.
from nzpc-2018.
Thank you for the explanation. Do you know what the time complexity is? I feel like it is O(2^n) but this bound might be too loose.
from nzpc-2018.
Running time for a single fold operation is linear in the number of segments (as I described above). Each fold can increase the number of segments by at most one (and can reduce it). So overall the worst case number of segments is number of folds + 1 and the worst case running time is O(V^2 + H^2) in number of horizontal and vertical folds. And there are only at most 20 folds!
from nzpc-2018.
@SamZhangQingChuan how does your solution to O work? :)
from nzpc-2018.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nzpc-2018.