# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13361 | Cardcaptor Sakura |
|
14134 | Strawhats' Bento Set |
|
14136 | Zoro's slash |
|
Description
Sakura is a girl with super card magic.
However, you cannot make a living with magic, computer science is all you need.
To make use of her card skills, she tries to write a program to play cards:
There are 10 tables (indexed from 0 to 9) and no cards on them initially.
Given a command S, Sakura has to follow the instructions below:
(1) print: print the status of each table with the format :"table_idx: cards_on_the tables\n", e.g. "0: 1 3 3 4 5\n".
Note that if there are no cards, print "No card".
(2) all num len : Place len cards on each table, and the value on each card is num .
For example, the instruction "all 3 4" changes the status of each table to "table_idx: 3 3 3 3\n";
(3)
place table_idx len
integer_sequence
: Place a stack of cards on table table_idx. len means the number of cards in the stack. An integer sequence integer_sequence of length len is given, in which each integer means the value on the placed card.
For example, the instruction will be like:
place 2 3
3 2 1
And the status of Table_2 will become:
2: 3 2 1
Note that if there are cards already on the target table, the status will be overridden.
(4) swap table_a table_b: Swap the cards on table_a and table_b.
For example:
If the origin status of table 0 and table 1 are:
0: 1 2 3
1: 4 5 6
after "swap 0 1", the status of the two tables become:
0: 4 5 6
1: 1 2 3
This instruction is valid even if one of the tables is empty.
(5) clear: Clean all the tables.
(6) exit: terminates
hint. You can use pointer array to record each table.
Input
Commands separated by a newline character.
Note that:
1 <= the value of each card <= 13
1 <= number of cards on each table <= 10000
Output
Status of each table.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The Strawhats are departing Wano!
Sanji is preparing bentos with a set of ingredients I.
He plans to make each bento with the set of all subsets of I, including I itself.
Chopper needs to list all the bento sets that Sanji is going to make.
Take example, the set of Ingredients 1
Ingredients 1 = {"Rice", "Salmon"}
Then, the bento sets he is going to make are {{"Rice"}, {"Salmon"}, {"Rice", "Salmon"}}
Here is another example set of ingredients 2
Ingredients 2 = {"Rice", "Seaweed", "Meat"}
Then the bento sets he is going to make are {{"Rice"}, {"Seaweed"}, {"Rice", "Seaweed"}, {"Meat"}, {"Rice", "Meat"}, {"Seaweed", "Meat"}, {"Rice", "Seaweed", "Meat"}}
But Chopper is too lazy to write all the ingredients... So he decided to label everything into a single number or alphabet!!
The set of Ingredients 1 becomes {'1', '2'}
and the bento sets are {{'1'}, {'2'}, {'1','2'}}
The set of Ingredients 2 becomes {'1', '2', 'a'}
and the bento sets are {{'1'}, {'2'}, {'1', '2'}, {'a'}, {'1','a'}, {'2','a'}, {'1','2','a'}}
Now help Chopper list the bento sets by the given specific set of ingredients.
Input
The string I that can be viewed as a set. (4 < the length of I < 21)
Output
Output the bento sets followed by a newline character at the end of each set
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Robin found an interesting poneglyph, instead of being a readable text, it is encoded with a specific pattern.
To decode the text, Robin told Zoro to slice the string to split it into readable text with his sword.
If Zoro knew python, he could easily use str.split() function. But he's got no programming skills.
For those who are not familiar with how the split function works:
Take example, string = Ixyzamxyzluffy
string.split('xyz') will result into string == ['I', 'am', 'luffy']
Note: This is a partial judge problem, please implement the function.h and don't forget to compile with C compiler.
oh, and be careful of the memory usage allocated dynamically to avoid MLE.
Input
String S that should be splitted, 20 < S < 499
Pattern string P, 1 < P < 9
Output
Output the strings splited by the given pattern.
Don't forget to include '\n' at the end of each output string.