|
|
Common Boardwhat is answer for that test 5 -9 4 -8 -6 1 -10 ? Answer is : Impossible! Why? obstacles -8 and -6 prevent you from going to point -9. Can you suggest what is causing this error. N = int(input()) s = [0] for i in range(N): k = int(input()) s.append(int(s[i] + k)) Q = int(input()) while Q: l, r = map(int, input().split()) print(s[r] - s[l-1]) Q -= 1 35 15 2 0 6 0 8 15 0 18 4 0 18 0 7 0 13 0 24 1 0 24 0 22 21 0 4 15 0 15 11 0 26 0 31 21 0 32 2 0 2 0 13 1 0 29 4 0 5 8 0 28 18 0 8 16 0 8 27 0 29 18 0 13 26 0 1 0 14 0 25 35 0 10 25 0 3 0 23 9 0 1 8 0 19 26 0 10 20 0 33 0 26 0 27 16 ans:12 28 5 0 15 0 8 22 0 23 20 0 6 19 0 1 22 0 9 28 0 14 15 0 5 0 7 18 0 18 0 16 0 27 0 8 0 27 0 19 3 0 24 8 0 2 25 0 22 0 15 12 0 8 5 0 12 0 6 0 2 9 0 25 0 9 9 0 9 0 2 0 19 15 ans:4 38 19 36 0 15 0 23 0 17 0 9 0 34 0 13 10 0 15 0 15 4 0 26 0 5 33 0 34 0 9 0 29 0 4 0 4 20 0 24 0 3 38 0 27 0 22 7 0 35 27 0 8 0 34 36 0 5 33 0 22 7 0 18 26 0 26 17 0 22 0 12 0 27 0 8 8 0 35 0 24 0 31 0 23 0 6 0 18 0 16 27 0 9 35 ans:7 37 34 0 16 3 0 24 0 14 24 0 33 18 0 17 0 33 32 0 18 16 0 19 1 0 8 0 29 34 0 1 25 0 7 3 0 28 0 34 0 1 21 0 36 0 18 0 36 21 0 27 0 14 0 15 5 0 33 0 9 32 0 35 14 0 22 1 0 18 35 0 6 0 30 0 1 2 0 30 0 20 0 18 0 30 0 30 0 11 0 15 37 0 1 6 ans:4 I hope they can help you~ Edited by author 26.08.2009 18:29 thanks! I got great help! your tests are simply. i got WA6 and got right answers on your tests. now AC So how to deal with WA#6? 8 <@...<@...<@...<@.....@>...@>...@>...@> .OO=..OO=..OO=..OO=.=OO..=OO..=OO..=OO. ./\.../\.../\.../\.../\.../\.../\.../\. Answer: 0 Help me: Wrong answer in test #6 Wrong answer in test №20, help Edited by author 10.03.2022 01:08 0 0 0 0 0 0 0 0 10 17 check this what's the test case 7???? All the cases given hv been passed alr... #include <iostream> using namespace std; int main() { int n, k, *arr,raz,y=0,ost=0; cin >> n >> k; arr = new int[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 0; i < n; i++) { raz = 5 - arr[i]; if (raz >= 0) { y = y + raz; } else { y = y; ost = ost + raz * -1; } } cout << ost << " " << y; return 0; } > raz = 5 - arr[i]; Why "5" ? ahahah I'm stupid :D Thanks) the task could be solved by shorter way // 2022-03-08.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int droid = 0, bum = 0; int tempBum; for (int i = 0; i < n; i++) { cin >> tempBum; if (tempBum > k) { bum += tempBum - k; } if (k > tempBum) { droid += k - tempBum; } } cout << bum << " " << droid; } try 12.12.12 1 Not a floating point number 5 7 1 2 2 3 1 4 4 5 1 5 2 5 4 3 4 3 4 7 2 ans: 1 1 2 3 Thank you so much! This really helped me debug :). On the first sight i thought i'd need O(3 ^ 16) but the problem is much easier. if you WA on #3 ,please use unsigned __int64 and high-accuracy if you WA on #9 ,try this 2 10 3 The answer is 0 Edited by author 03.03.2022 10:56 cnt = 0 a = int(input()) a1 = list(map(int, input().split())) b = int(input()) b1 = list(map(int, input().split())) c = int(input()) c1 = list(map(int, input().split())) for i in a1 : if i in b1 and c1 and a1 : cnt += 1 print(cnt) what is wrong? tells "wrong answer" Probably you're getting overflow Arithmetic average is not exacltly x. Due to the rounding arithmetic average can be x + 0.01 or even x + 0.04999 \/ \/ /\ /\ 8 4 0 0 2 2 2 0 0 2 0 3 2 5 2 3 0 5 1 2 3 4 5 6 7 8 Answer: "NO" Spent a hour to realise that you don't need to count left and right parts of figure, only middle Edited by author 27.02.2022 15:58 I investigated on internet, but most of the answers were putting a type of character that breaks the cycle, but in the input example there´s no character and it´s not enough with a "while(cin >> n)" pls help if copypast test text, it read a blank string as EOF by some reason Edited by author 26.02.2022 22:11 |
|
|