Общий форумif you get WA on test #2, then try to use unsigned char* instead char* I have done it with char s[], you don't have to use unsigned char s[] !!! I used scanf ... Edited by author 03.04.2010 00:08 I had WA2 with some test like this 'a' like '[a-]' YES Because there may be spaces in the input, "scanf("%s")" may not be accepted... 2 'like' like 'like' ''' '' ' like ''' ''%' YES YES Tests may also have spaces, so it is a confusing question to determine how to get the string and the pattern. I got 14 WA on this question, and finally AC. QWQ Edited by author 14.10.2015 20:17 Try this test: 2 1 1 3 answer: 2 3 1 4 I have wa#9,but my program does well in your data The case given here helped me. Notice that when you are selecting whether white part is to be selected or black part, and pushing the result in a vector or queue, due to DP, last part gets inserted first. So you have to consider that first result in the vector/queue is for the last pair of partition. May be this will help... 2 4 1 2 2 1 1 2 2 1 answer: 1 3 2 4 answer 1 2 3 4 is correct too. But I have wa3 from math import sqrt n = int(input()) l = list(map(int, input().split())) t = [] for i in range(n): for j in range(n): if l[i] == l[j]: t.append(l[i]) l = 0 for i in range(len(t)): if t[i] != l: print(int(sqrt(t.count(t[i]))),t[i], end=' ') l = t[i] что за тест в чем ошибка? I haven't idea how to approach this test? my code is simple O(n^4),but #9 test doesn' work: for (i=1;i<=n;i++) { for (j=1;j<=n;j++)
s[i][j]=s[i-1][j]+s[i][j-1]+a[i][j]-s[i-1][j-1];
} for (i=1;i<=n;i++) for (j=1;j<=n;j++) { for (k=i;k<=n;k++) { for (m=j;m<=n;m++) { sum=s[k][m]-s[i-1][m]-s[k][j-1]+s[i-1][j-1];
if (sum>max1) max1=sum;
} } } I had the same problem. Firstly I used array of short and there was overflow in sum (max possible sum is 127 * 100 * 100 = 1270000 > 32767). Then I changed type to int and got AC :) getting WA9 What can be the problem ? WA9 happens when in attempt of optimization you try to convert the name of an option into int64, but miserably fail at that. Like, (1..26)27^0 + (1..26)27^1 + (1..26)27^2 + ... I simply forgot the increment, so i had (1..26)27^0 + (1..26)27^0 + (1..26)27^0 + ... It's too funy! I forgot to check one little moment if(goods[v[0].s] == 0){ time++; v.pop_front(); continue; } Or try this test: 1 1 of hell 3 1 of lol 2 of azaz 3 of bug Answer: 3, but my old programm gives 5 LOL, Good Luck! My problem is not this that gives the correct answer, but despite that WA9 Try this: 1 1 of a 3 1 of a 1 of a 1 of b Correct answer is 3. Почему не проходит тест? Вроде все правильно WA in Case #6. Could you give me the case? Edited by author 11.10.2015 17:59 Edited by author 11.10.2015 17:44 Just print: 1)2*n-1 2)1 2 ... n 3)n n-1 ... 2 It's work, but why? example 4 1 2 3 4 4 3 2 original 4->3->2->1->2->3->4 They don't meet They meet at the 6th point(3 = 3). Why do you need to print that 1 at the beginning? You don't need it. 2 3 4 4 3 2 also works fine. But 3 2 1 3 2 (or 2 3 4 2 3) is shorter. Please help me, what is wrong with my solution.... Const MaxN = 100000; Var b : array[1..MaxN] of boolean; c : array[1..2,1..MaxN] of longint; c_num,n,m,i,x,y : longint; BEGIN Readln(n,m); Fillchar(b,sizeof(b),true); Fillchar(c,sizeof(c),0); c_num := 0; For i := 1 to m do begin Read(x,y); if b[x] and b[y] then Begin Inc(c_num); c[1][c_num] := x; c[2][c_num] := y; b[x] := false; b[y] := false; End; End; Writeln(c_num); For i := 1 to C_num do Begin Writeln(c[1][i],' ',c[2][i]); End; END. Try such test... :) 4 3 2 3 1 2 3 4 Correct answer is 2 1 2 3 4 I don't think, that greedy is a good idea... Try this one 4 3 1 2 1 3 3 4 Correct Answer: 2 1 2 3 4 Кто решил,напишите пару тестов. import sys def wall_scaner(amount, wall): count = 0 high = 0 mid_number = '' while count < int(amount) - 2: summ = 0 unit = wall[count:count + 3] for i in unit: summ += int(i) if summ > high: high = summ mid_number = count + 2 count += 1 return high, mid_number data1 = sys.stdin.readline() data2 = sys.stdin.readline() amount = ''.join(data1.split()) wall = ''.join(data2.split()) answer = wall_scaner(amount, wall) print(answer[0], answer[1]) plz tell me what's wrong this code always return right format and answer for me ты считаешь тройки одинаковых рядом цифр, а по заданию это не нужно. Нужно найти суммарный максимум из рядом стоящих не обязательно это будут 777 может и 845 n = int(input()) sp = list(map(int, (input().split()))) ind = 0 MAX = sum(sp[:2]) for i in range(n - 2): if sum(sp[i:i+3]) > MAX: MAX = sum(sp[i:i+3]) ind = sp.index(sp[i]) + 2 print(MAX, ind) Edited by author 08.10.2015 18:07 What's wrong? Please, answer me. #include <iostream> #include <vector> using namespace std; int main() { bool z; vector <int> so(0), st(0); unsigned int a; cin >> a; while (so.size() < a) { int soe; cin >> soe; so.push_back(soe); } unsigned int b; cin >> b; while (st.size() < b) { int ste; cin >> ste; st.push_back(ste); } for (unsigned int i = 0; i < so.size(); i++) for (unsigned int j = 0; j < st.size(); j++) { if (so[i] + st[j] == 10000) { z = true; } } if (z == true) { cout << "YES" << endl; } else { cout << "NO" << endl; } } Edited by author 24.10.2015 04:23 New test was added, 1158 AC solutions failed. Hi there, My AC code (and, I think, many others) outputs "-1" for the following test, whereas according to the problem statement right answer is "3": 1 5 +-+-+-+.+-+ | | .1|2| | +-+.+-+-+-+ It seems this problem needs more good tests. Up Edited by author 16.01.2013 18:30 Up If you have more good tests, send them to timus_support@acm.timus.ru Do you check this mailbox? Some time ago I sent new tests for 1005 to kill greedy sols - and no reaction on timus side. If you really need new tests for this problem and will add them - I can prepare. Some time ago limitations have been modified to 2 <= n, m (was 1 <= n, m). Sorry for misinformation. I think the problem could be more interesting and challenging with old limitations and new tests. Currently it is rather straightforward. It should be "Death" for your test case as they need to "always" stay close together. Even when one of them is out. You're wrong. According to the problem statement they need to stay close to each other only in order to keep moving. Here it is possible for both of them to leave the labyrinth. > You're wrong. According to the problem statement they need to stay close to each other only in order to keep moving. Your interpretation is not supported by the problem language. I agree with tvhong, the problem statement clearly says that they must stay close. If your interpretation was correct then the second sample would not be "Death." I thought ranking was determined first by solution time, with ties broken by submission date. But you can see here: http://acm.timus.ru/rating.aspx?space=1&num=1797 that the #1 ranked solution has the same solution time as the other top submissions, but a later submission date. Why is this? There are too many different cases to consider, use a brute-force approach to get AC on the first attempt with one page of code: 1) write a function that checks that the situation is good; 2) for every coordinate make a list of four interesting values (all values taken by existing potatoes and some others if this is not enough); 3) try all possible ways to move none, one, or two potatoes, so that the coordinates of the new position are from the interesting values. Disagree. There're only 7 cases to consider. |
|