CubeStickers
SRM 507 · 2010-11-01 · by ir5
Problem Statement
NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.
Fox Ciel has a cube and some colored stickers. You are given a
If this is possible, return "YES", otherwise, return "NO" (all quotes for clarity).
Constraints
- sticker will contain between 6 and 50 elements, inclusive.
- Each element of sticker will contain between 1 and 10 lowercase letters ('a'-'z'), inclusive.
{"cyan","magenta","yellow","purple","black","white","purple"}
Returns: "YES"
One of the possible ways is shown in the following picture:
{"blue","blue","blue","blue","blue","blue","blue","blue","blue","blue"}
Returns: "NO"
{"red","yellow","blue","red","yellow","blue","red","yellow","blue"}
Returns: "YES"
{"purple","orange","orange","purple","black","orange","purple"}
Returns: "NO"
{"white","gray","green","blue","yellow","red","target","admin"}
Returns: "YES"
{"xxxxxxxxxc"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxa"
,"xxxxxxxxxb"
,"xxxxxxxxxb"
,"xxxxxxxxxa"
,"xxxxxxxxxa"}
Returns: "NO"
a bit slow? -yes, but a bit strange as the number of iterations inside the last cycle is less.
Submissions are judged against all 193 archived test cases, of which 6 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class CubeStickers with a public method string isPossible(vector<string> sticker) · 193 test cases · 2 s / 256 MB per case