Common Boardpoint is equal. e.g. 3 3 1 1 1 1 111 111 111 answer:1 0 Can someone give me data of test #11? I have test all data in discussion section and got right answer but my program just stuck in test #11.... 4 6 1 2 1 1 3 5 3 4 1 4 2 3 4 1 8 2 3 0 is this test #11? задача решается всё норм я знаю что она решается, у меня AC. я говорю про то, что на Go 1.1 простой способ считывания входных данных работает некорректно, и прошу разобраться - это бага fmt.Scanf или что-то с форматом test #3. Try to read integers in the first string using format "%v %v\n" instead of "%v %v". It's not evident, but... it works! If solution reads the first string using fmt.Scanf("%v %v\n",&n,&k) then it gets AC. Thanks, Sandro (USU)! Some new tests were added. 234 authors lost AC. Maybe we'll add more tests soon. Some more tests were added. 200 authors lost AC. Edited by author 14.12.2011 23:32 I think there is a problem here. My pascal solution has failed and WA 14 now, and it was accepted before. And my C++ solution is still AC and I have recently retyped the same Pascal solution that failed, into C++, and both codes are exactly the same, except one is C++ and the other one is Pascal. What could be the problem? Try simple test: 2 0 0 1 1 As I see from the problem statement, this test is incorrect =) You are right, this test is incorrect. :) And there is no such test in the test set. But FreezingCool's Pascal and C++ solutions give different answers on this test. The answer to this test is 2, which my program correctly gives. I received WA12. Unless the geometric formula has changed in 5 years, then the new tests could be with boundary conditions. Thank you for taking the time to answer. I find out, that test 14 requires high accuracy of comparsion of two double(float) values. I used e=0.000000001 and i got AC. Do calculations in integer numbers - and won't have troubles with precision. Каким должен быть ответ ,если значения n или k не валидны? Например, если не указать k. Или ввести значения, не попадающие в диапазон? RTFM: http://acm.timus.ru/help.aspx?topic=judge "Input data in the test cases always satisfy the constraints described in the problem statement. You don’t need to verify these constraints in your solutions." I don't know why I get WA on test 4! Can there be a negative number? This is my code: #include<iostream> #include<cmath> using namespace std; long long dyn[110][510] , a[110][510] , big, sum[110][510] , p[110][510][2] , o , m, n; int main(){ cin>>m>>n; for(int i=0;i<m;i++) for(int j=0;j<n;j++) cin>>a[i][j]; for(int i=0;i<m;i++) { sum[i][0]=a[i][0]; dyn[i][0]=100000000000000000; for(int j=1;j<n;j++) { sum[i][j]=sum[i][j-1]+a[i][j]; dyn[i][j]=100000000000000000; } } if((m==1)&&(n==1)) { cout<<1<<endl; return 0; } dyn[m-1][0]=a[m-1][0]; for(int i=1;i<n;i++) { dyn[m-1][i]=a[m-1][i]; } for(int i=m-2;i>=0;i--) { for(int j=n-1;j>=0;j--) { for(int k=0;k<n;k++) { if(j>k) { if(dyn[i+1][k]+sum[i][j]-sum[i][k-1]<dyn[i][j]) { dyn[i][j]=dyn[i+1][k]+sum[i][j]-sum[i][k-1]; p[i][j][0]=j; p[i][j][1]=k; } } else { if(dyn[i+1][k]+sum[i][k]-sum[i][j-1]<dyn[i][j]) { dyn[i][j]=dyn[i+1][k]+sum[i][k]-sum[i][j-1]; p[i][j][0]=j; p[i][j][1]=k; } } } } } big=dyn[0][0]; o=0; for(int i=1;i<n;i++) { if(dyn[0][i]<big) { big=dyn[0][i]; o=i; } } cout<<o+1; for(int i=1;i<m-1;i++) { if(p[i][o][0]<=p[i][o][1]) { for(int j=p[i][o][0];j<=p[i][o][1];j++) cout<<" "<<j+1; } else { for(int j=p[i][o][0];j>=p[i][o][1];j--) cout<<" "<<j+1; } o=p[i][o][1]; } cout<<" "<<o+1<<endl; return 0; } No there can't be. My ac code. [code deleted] Edited by moderator 19.11.2019 23:27 Seems like your AC code fails at test: 5 5 10 1 10 10 10 1 1 10 10 10 1 10 1 1 1 1 1 1 10 1 10 10 10 10 1 I'm sorry. I should be more careful while reading the problem statement. The correct answer here is 2 2 1 1 1 1. Not 2 2 1 1 1 2 3 3 4 5 5 5. Хотелось бы пример теста #pragma comment(linker, "/STACK:16777216") #include <iostream> using namespace std; char str[100001]; bool isPalind(int start, int finish) { int fin = finish-1;//(int)finish-48 - 1; bool answer = true; for (int k=start-1; k<fin; k++) { if (str[k] != str[fin]) { return false; } fin--; } return true; } int main() { char c1, c2; int pos=0, m, fin; cin >> str; scanf("%d\n", &m); for (int i=0; i<m; i++) { scanf("%*[^? ]%c%d ", &c1, &pos); if (c1 == ' ') { scanf("%c", &c2); str[pos-1] = c2; } if (c1 == '?') { scanf("%d", &fin); if(isPalind(pos, fin)) { printf("Yes\n"); } else { printf("No\n"); } } } return 0; } Edited by author 01.11.2013 00:11 Асимптотика же O(nm) у вас. Пример теста: ааа..ааа (10^5 штук), и 10^5 запросов: ? 1 100000 How I can do it on 0.001? Edited by author 31.10.2008 02:29 Edited by author 16.06.2009 00:42 ATT Binary Search can solve it. :) I don't see any dynamic programming in this problem... Edited by author 02.11.2013 13:47 I was trying many times to get past first test and fixed a few mistakes in the algorithm to no avail. And the reason to fail was that the output was in brackets. У меня все работает с разными данными. Мне кажется я не правильно поток ввода установил. Здесь нужно использовать cin? How it is posible to get AC in 0.001 s? What time do such ACs take to get L for K= 99999989? Could anyone give a hint to make it faster than O(sqrt(K))? I think one can get AC in 0.001 by giving solutions that have precalculated values for K = 3...10^8. Could you please give me some tests? Edited by author 31.10.2013 02:11 How to pass this test? I got WA for several times. I had WA @ #85 for many times, too. Try this testcase: k = 144 The correct answer is n = 185, rather than n = 169. The same factor, 13, could NOT be used twice in different layers of search. Good luck. if k = 144 my program gives n = 185, but I got WA 85, Why ? if k = 144 my program gives n = 185, but I got WA 85, Why ? Why do I get wrong answer in the 42th case? this problem is easy Edited by author 30.10.2013 13:06 |
|