Submit | All submissions | Best solutions | Back to list |
BLOPER - Operators |
Given a set of N integer A = {1, 2, 3, …, N} and a integer S, your task is find a way to insert an operator ‘+’ or ‘-‘ to every neighbor pair of A, that the result of the expression after insert equal to S.
Input
A single line, N and S (1 ≤ N ≤ 500, |S| ≤ 125250)
Output
If there are way(s) to insert, outputs any of them, otherwise outputs “Impossible” (without quotes).
Example
Input: 9 5 Output: 1-2+3-4+5-6+7-8+9
Input: 5 6 Output: Impossible
Added by: | Kata |
Date: | 2014-03-28 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
||||||
2016-02-21 19:38:33 pbd
fails at case 23 |
||||||
2016-02-06 06:53:34
AC finally Last edit: 2016-02-06 07:00:14 |
||||||
2015-02-07 20:15:10 Kata
Time limit of this problem changed automatically (I talked about it at forum few days ago), so I set it back to latest state. (Francky) ⇒ Thanks Last edit: 2015-02-07 20:27:04 |
||||||
2015-02-07 19:47:56 Francky
@psetter : please explain why you moved this problem, and changes if they are. |