You've just discovered Odoo, an awesome suite of web-based open-source business apps. Not only impressed by the idea and quality of the apps, you, as a member of the open-source community, loved the fact that Odoo is open source.
After hours reading the codebase and learning how Odoo works, you decide to check the commit history of the most fun app: Real State! But wait... you just realized... there is a pattern in some of the author emails! Of course! Odoo employees! There is also a whole team of developers making sure the codebase is clean and developing new features!
You realized that Odoo emails have the format S@odoo.com, where S is a string of lowercase letters with size 2, 3 or 4. Really excited by your own discovery, you decide to write a script to check if an email is a potential Odoo email. That is, if it follows the described format.
The only line of the input contains a string $$$E$$$ ($$$1 \leq |E| \leq 50$$$, $$$|E|$$$ is the size of the string E).
Print yes if $$$E$$$ follows the format in the statement and no otherwise.
pf@odoo.com
yes
palm@odoocom
no
im_not_an_email
no
jcsc@odoo.net
no
nAsg@odoo.com
no
It's party time at Odoo! These Odooers... they sure know how to party! However, as any mortal human being, they are having trouble setting up the printer for decorations.
The printer was supposed to print a nice big ODOO strip, but, instead, it printed a scrambled sequence of O's and D's, even with more letters than needed. For instance, it just now printed ODODODODODO...
The party organization committee is now going to fix the strip, making it a proper ODOO, but following the operations bellow:
Being the clever bunch they are, the Odooers want to fix the strip as quickly as possible. How many minutes will it take them at the least? Both operations above have the same cost of 1 minute to be done.
The first line of the input contains an integer $$$T$$$ $$$(1 \leq T \leq 10)$$$ indicating the number of test cases.
Each of the following $$$T$$$ lines contains a string $$$S$$$ $$$(4 \leq |S| \leq 10^3)$$$ of upper-case O's and D's in any order.
Print the minimum amount of minutes needed to transform $$$S$$$ into ODOO following the operations described in the statement.
6ODOODODOODODODODDDDDDDDDDODODODOOODO
0 2 2 8 5 2
We're trying to install $$$n$$$ Odoo modules from your local machine to the server.
Imagine that the path from your local machine to the server is a line where your machine is at position $$$0$$$ and the server is at position $$$k$$$ ($$$k = 10^{9}$$$, fixed).
Initially, each module has:
Each second, the module advances $$$1$$$ unit (its position advances by $$$1$$$).
You started the installation, and all your modules were moving to the server, but someone introduced $$$m$$$ viruses in different positions of the line in the opposite direction of the installation (right to left) (Viruses move with the same speed).
Each virus has different capacities to impact each module. It can have capacity $$$X$$$ against module $$$A$$$ and capacity $$$Y$$$ against module $$$B$$$.
When a module and a virus collide (touch each other at any part of the line):
The first line contains $$$3$$$ integers $$$n$$$, $$$m$$$, and $$$q$$$ $$$(1 \leq n \leq 10^{3}, 1\leq m \leq 5\cdot 10^{3}, 0 \leq q \leq 5\cdot 10^{5})$$$ denoting the number of modules, the number of viruses, and the number of the capacities of viruses against modules.
Each of the following $$$n$$$ lines contains $$$module_{i}$$$, $$$capacity_{i}$$$, and $$$modulePosition_{i}$$$ ($$$module_{i}$$$ is a string, $$$1\leq length(module_{i}) \leq 20$$$, $$$1 \leq capacity_{i} \leq 10^{5}$$$, $$$0 \leq modulePosition_{i} \leq k-1$$$) denoting the name of the $$$i_{th}$$$ module, its capacity, and its initial position. It's guaranteed that there is no space in the name of the module, and no two modules have the same name. It's also guaranteed that no two modules have the same position.
Each line in the $$$m$$$ following lines contains $$$virus_{i}$$$ and $$$virusPosition_{i}$$$ ($$$ 1 \leq virus_{i} \leq m$$$, $$$0 \leq virusPosition_{i} \leq k-1$$$) denoting the $$$ID$$$ of the virus followed by its initial position. It's guaranteed that no two viruses have the same $$$ID$$$. It's also guaranteed that no two viruses have the same position.
Each line in the $$$q$$$ following lines contains $$$virus_i$$$, $$$module_i$$$, $$$capacityAgainst_i$$$ $$$(1\leq virus_i \leq m, 1\leq capacityAgainst_i \leq 10^5)$$$ denoting the $$$ID$$$ of the virus followed by the name of the module and its capacity against that module. It's guaranteed that $$$module_i$$$ exists in the list of modules. It's guaranteed that every pair of virus and module pair appears at most one time.
If a module and virus exist in the same position at the beginning, they collide.
Print the number of modules remaining in the first line. Print the names of the remaining modules sorted by arrival time in increasing order in the second line separated by spaces.
5 3 7Project 5 0Time-Off 1 70To-do 80 4Timesheets 10 10Employees 2 401 152 503 601 Time-Off 1001 Employees 2002 To-do 842 Project 43 Employees 43 To-do 503 Project 2
2 Time-Off Timesheets
At Odoo, several tasks are processed daily on our dedicated servers. These tasks need to be inspected by a person who guarantees correct performance in all of them.
Natan is in charge this week, but he needs to finish all the tasks within the time limit set for him. However, to save more resources, Natan needs to find out the smallest amount of dedicated servers that will be needed to finish all tasks within the time limit or verify that this is impossible.
Each task takes a certain duration to perform. All the tasks need to be started in order (i.e., task $$$i$$$ just can start if task $$$i-1$$$ starts at the same time or at an earlier time).
Each dedicated server can only perform a maximum of one task at a time and it can start a new task as soon as it finishes the one it is currently doing.
As a new developer at Odoo, you were tasked with helping Natan solve this problem. Find out the smallest number of dedicated servers needed to perform these tasks or, if impossible, print the number -1.
The first line contains two integers, $$$N$$$ and $$$T$$$ $$$(1 \leq N, T \leq 10^{5})$$$, representing the number of tasks and the time limit to do the tasks, respectively.
The second line contains $$$n$$$ integers $$$A_{i}$$$ $$$(1 \leq A_{i} \leq 10^{5})$$$, where $$$A_{i}$$$ represents the duration of the task $$$i$$$.
Print a number $$$Q$$$ containing the smallest number of dedicated servers needed to perform these tasks or if it is impossible to do all the tasks within the time print the number -1.
5 11 1 1 1 1
5
5 51 1 1 1 1
1
5 51 2 3 5 6
-1
Odoo has introduced its new POS Kiosk app, which allows restaurants to receive orders from clients in their shop and process them easily. So basically, there are 2 main functionalities of the POS kiosk: add order , mark order as done so it's removed from the screen.
For performance reasons, the updates in the database are made in batches. It means that for each batch of updates, there is only one query executed to remove/add records to the database.
To test the database performance, Odoo developers came up with the following process :
Given the generated array $$$A$$$, can you simulate the experiment and find : $$$$$$\sum_{1\leq L \leq R\leq n}f(A,L,R)$$$$$$
The first line contains an integer $$$T$$$ $$$(1 \leq T \leq 2 \cdot 10^{5})$$$, the number of testcases.
For each test case:
The first line contains an integer $$$n$$$ $$$(1 \leq n \leq 2 \cdot 10^{5})$$$, the size of the generated array of updates.
The second line contains $$$n$$$ integers $$$A_{i}$$$ $$$(-2 \cdot 10^3 \leq A_{i} \leq 2\cdot 10^{3})$$$, the data of the generated array.
The sum of $$$n$$$ over all test cases doesn't exceed $$$2\cdot 10^{5}$$$
Print $$$T$$$ lines where the $$$i_{th}$$$ line contains the answer for the $$$i_{th}$$$ testcase.
23-2 3 -571 -2 3 4 5 -10 223
8 1672
Explanation of the first test case:
The total sum is equal to $$$8$$$
There are $$$n$$$ employees at Odoo numbered from $$$1$$$ to $$$n$$$, each employee has exactly $$$1$$$ manager, except for the head with the number $$$1$$$ who has no manager. So they form a rooted tree.
We call employee $$$a$$$ a subordinate of another employee $$$b$$$ if either $$$b$$$ is the manager of $$$a$$$, or the manager of $$$a$$$ is a subordinate of employee $$$b$$$. In particular, subordinates of the head are all other employees of the company.
You will be given very sensitive information: An integer array $$$A$$$ of size $$$n$$$ where $$$A_i$$$ is the salary of the $$$i_{th}$$$ employee at Odoo $$$(1 \le i \le n)$$$.
For the following $$$q$$$ years, at the beginning of the year, one lucky employee $$$u$$$ is picked alongside an integer value denoted as $$$x$$$. For that employee, their salary will be multiplied by $$$x$$$. Also, for all subordinates of $$$u$$$ their salary will be multiplied by $$$x$$$ as well.
An employee is happy at some year if their salary was divisible by $$$k$$$ in that year. You will be given the value of $$$k$$$ and your goal is to print $$$n$$$ integers where the $$$i_{th}$$$ integer $$$(1 \leq i \leq n)$$$ is the first year at which employee number $$$i$$$ was happy.
If one employee was happy initially print $$$0$$$ and if they were never happy print $$$-1$$$.
The first line contains $$$3$$$ integers $$$n$$$, $$$k$$$, $$$q$$$, $$$(1 \leq n, q \leq 2*10^{5})$$$ $$$(1 \leq k \leq 10^{9})$$$
The second line contains $$$n$$$ integers $$$A_1, A_2, .. , A_n$$$ $$$(1 \le A_i \le 10^{9})$$$
The third line contains $$$n - 1$$$ integers $$$P_2, P_3, .. , P_n$$$ where $$$P_i$$$ is the manager of employee number $$$i$$$. $$$(1 \le P_i \le n)$$$
Then $$$q$$$ lines follow, The $$$i_{th}$$$ line contains two integers $$$u_i$$$ and $$$x_i$$$ $$$(1 \le u_i \le n) (1 \le x_i \le 10^{9})$$$
Print $$$n$$$ integers, the answer to the problem
5 4 41 2 3 4 61 1 2 22 33 21 22 7
-1 3 3 0 3
9 10 84 6 7 4 9 10 8 7 96 6 6 7 1 1 7 18 23 59 73 65 26 22 106 10
-1 7 4 8 -1 0 -1 -1 -1
In Odoo, we foster a large open-source community offering a plethora of apps, all accessible for free. Kinho dedicates himself to developing and enhancing select apps within this ecosystem. While each app boasts a wealth of features, let's simplify our focus to four key attributes:
To compute the profit for app $$$i$$$ on a specific day $$$d$$$, we use the following formula:
$$$$$$profit_{i} = PR_{i} * d + bonus_{i}$$$$$$
It's noteworthy that when Kinho develops a new app, its profit rate is strictly greater than its parent app. This is because the primary motive behind developing a new app is to enhance an existing one.
Now Kinho is curious, given an app and considering all the apps from which it inherits, what is the highest profit for app for a given day?
The first line contains two integers, $$$N$$$ and $$$Q$$$ $$$(1 \leq N, Q \leq 10^5)$$$, representing the number of installed apps and the number of queries, respectively.
The subsequent $$$N$$$ lines each contain four integers: $$$id$$$, $$$Pid$$$, $$$PR$$$, and $$$bonus$$$ $$$(1 \leq id \leq N, 0 \leq Pid \leq N, -10^9 \leq PR, bonus \leq 10^9)$$$, representing an app. It is guaranteed that all ids are unique, meaning no two apps share the same id. Additionally, there is exactly one app with $$$Pid$$$ equal to $$$0$$$, which serves as the dashboard app and has no parents.
The following $$$Q$$$ lines each contain two integers, $$$id$$$ and $$$D$$$ $$$(0 \leq D \leq 10^9)$$$, representing the id of the respective app and the day for which Kinho wants to determine the highest profit for each ancestor app, including itself.
For each query, print an integer representing the highest profit for all apps that are ancestors of the given app, including itself.
4 21 0 80 5314 1 83 4383 1 90 7332 3 91 1764 83 11
1171 1723
9 29 8 171 1391 0 64 7107 1 121 2853 7 174 7944 6 226 5308 1 114 1065 6 186 9932 3 250 6116 8 152 8819 987 62
16897 7787
5 25 3 760 4321 0 46 404 5 1558 8462 1 705 3903 1 53 364 344 3
53818 5520
In the Odoo interface, you realize that it's all about views and smart buttons. Let's consider that Odoo has N distinct views and for each view, there are some smart buttons to take you to other views.
It's guaranteed that :
Since views are a very important part of Odoo, they should be tested carefully. That's where the Odoo tour test comes into play. The developers at Odoo developed an automatic testing program which will run infinitely. The test consists of a cyclic list of views of size $$$k$$$ (not necessarily distinct). At the start, the program starts from a view at some position $$$p$$$ in the list, then he goes to the next view at position $$$p+1$$$ using the minimum number of clicks, then to the view at position $$$p+2$$$ and so on (the view at position $$$1$$$ comes after the view at position $$$k$$$). A view is called tested if it is visited at least one time at some point during the test. You realized that some views might not get tested, so you introduced some updates to the original list of views and some other queries to collect analytics. The queries go as follows:
The first line of the input contains $$$2$$$ integers $$$n$$$ and $$$k$$$ $$$(1\leq n\leq 10^{5}, 1 \leq k \leq 10^{5})$$$, the number of views and the size of the list of views of the test.
The second line contains $$$k$$$ integers $$$v_{i}$$$ $$$(1\leq v_{i} \leq n)$$$, the ids of the views in the list of the test.
The next $$$n-1$$$ lines each contain $$$2$$$ integers $$$u$$$ and $$$v$$$ $$$(1\leq u, v \leq n, u \ne v)$$$, which means that views with id $$$u$$$ and $$$v$$$ have a smart button that connects them.
The next line contains an integer $$$q$$$ $$$(1\leq q\leq 10^{5})$$$, the number of queries to process.
The next $$$q$$$ lines each contain $$$3$$$ integers $$$t$$$, $$$p$$$, and $$$u$$$ $$$(1\leq t\leq 2, 1\leq p \leq k, 1\leq u\leq n)$$$, the description of the query.
Print the answer for each query of the type $$$2$$$ in separate lines. It's guaranteed that there is at least one query of type $$$2$$$.
9 44 6 8 91 22 33 44 52 62 76 84 982 2 92 1 72 4 82 4 92 1 92 2 21 3 12 2 2
6 -1 5 0 9 3 1