My 4th Times!

战略上藐视敌人,战术上重视敌人。

一切的敌人都是纸老虎,但是避免不了纸老虎后面还有个纸老虎。。。 

c++解决 # T590655 【MX-X10-T2】[LSOT-4] NetEase Cloud Music ## 题目背景 Don't underestimate my intelligence network. I know your annual music genre is anime, and your annual keywords are future, world, forever, right? ## 题目描述 In 2077, NetEase Cloud Music introduced a statistical feature. Each song has a "quality value" (any integer), and the "combined value" of any two consecutively listened songs is the sum of their quality values. In 2077, Little H listened to $n$ songs, but he does not know the quality values of each song. You are given the combined values $S_i$ for $1 \le i < n$, where $S_i$ corresponds to the $i$-th and $(i+1)$-th songs. Now, Little H wants to change his listening method: he will listen to songs $m$ times, and in the $i$-th listening session, he will listen to the $a_i$-th song $b_i$ times. Little H asks you to calculate the total sum of the quality values of all songs listened to in the new method. **A song listened to multiple times contributes its value multiple times**. However, if it is impossible to determine the total sum uniquely, output `Impossible`. ## 输入格式 - The first line contains two integers $n$ and $m$, representing the number of songs and listening sessions. - The second line contains $n-1$ integers $S_1, S_2, \ldots, S_{n-1}$. - The next $m$ lines each contain two integers $a_i$ and $b_i$, describing the $i$-th listening session. ## 输出格式 Output one line containing an integer—the total sum of quality values. If the sum cannot be uniquely determined, output the string `Impossible`. ## 输入输出样例 #1 ### 输入 #1 ``` 5 2 8 6 7 2 2 2 3 2 ``` ### 输出 #1 ``` 12 ``` ## 输入输出样例 #2 ### 输入 #2 ``` 5 2 8 6 7 2 2 2 3 10 ``` ### 输出 #2 ``` Impossible ``` ## 输入输出样例 #3 ### 输入 #3 ``` 20 19 425 46 176 409 156 35 128 467 534 411 362 760 32 17 403 210 462 10 94 15 104 12 193 6 249 18 845 1 72 15 269 2 633 10 858 14 282 14 950 5 98 11 162 12 296 14 846 15 793 11 858 19 942 1 886 19 968 ``` ### 输出 #3 ``` 283895 ``` ## 说明/提示 **Sample Explanat
03-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值