|
|
I try to output zeros in this case, but seems like I'm wrong please show me some example for example for this case 2 11 11 Edited by author 11.12.2007 21:50 This test is correct, and the answer should be 00 00 The test is correct, original sequences do not need to be compatible Can someone give me a little hint, please ? make 2 sequences (s1 and s2) such that s1[i]+s2[i]<>2 My solution is based on a greedy approach. Thank you both ! :-) I think that an algorithm has many special cases. Main rool:to correct firstly s2[i] from 1 to 0 in pair s1[i]=1 and s2[i]=1 diminishing B but have pair 0, 0 in older position correcting it to 0, 1 for final increasing lexiographicly of B Who can find all cases he solve the problem After getting AC i have counted 6 cases next tests correspong each of cases 4 1011 0011 1011 0100 4 1010 0111 1011 0000 4 1011 0110 1100 0000 4 1111 0101 0000 0000 4 1010 0101 1011 0000 4 1011 0100 1100 0000 Edited by author 21.02.2007 13:58 My program successfully passed all of your test cases, but I still WA3... What can it be??? You are need in additional tests Best if you will create them yourself I have only 3 cases 1) attempt to build a >b 2) attempt to build a+1 0 3) build 0 0 A + B = A XOR B iff there is no carry, or in other words A AND B = 0 So the algo is simple Find leftmost x such that p[x]=q[x]=1. if none, assume x=n+1. Find rightmost y to the left of x such that p[y]=q[y]=0. If none, output p+1, 0 (p+1 may become 0). Otherwise set q[y]=1, and q[y+1..n]=0 Edited by author 12.07.2026 04:38 I've got wa#11. But all test in forum my prog give right answers. Please give me more testcase. try this: 8 01100110 01100110 01100110 10000000 Is it: 1) A OR B (element-wise OR) 2) A + B (where A, B are numbers) ?.. (A + B) mod (2^n) ? i.e. string with length n? A+B as numbers, and defined only for non-overflowing addition of same-length sequences Edited by author 14.07.2008 01:52 I think my algo is correct but I still have WA 17. I saw that some people had TLE 17, can anybody tell my what kind of test is it? got AC :) I had very stupid mistake Those TLEs are probably attempts to find test internals because the problem is linear. I'm too stupid!!! Don't read this!!! It's seems that task is not hard but I still can't solve it I can't find mistakes I have WA3 Really, try this test 5 00110 00110 00110 01000 This one make my solution right. int main() { // freopen("input.txt", "r", stdin); scanf("%d", &n); scanf("%s%s", a, b); FOR(i, n) a[i]-='0',b[i]-='0'; REPD(i, n-1, 0) if(a[i]+b[i]==0 && b[i]==0){ b[i]++; REP(j, i+1, n-1)b[j]=0; out(); return 0; } REPD(i, n-1, 0)if(a[i]==0){ a[i]=1; REP(j, i+1, n-1)a[j]=0; ZERO(b); out(); return 0; } ZERO(a);ZERO(b); out(); return 0; } If A = "010" and B = "010", then A + B = "100" ? Yes? it is correct. (2+2=4) I think it's not clear enough that all sequences (especially result pair (a, b)) must have length n. Can you give me a test I have WA3 May be I don't understand problem) Test 3 have uncompatible pair (p, q) try this tests: 2 01 01 answer 01 10 3 101 011 answer: 110 000 Edited by author 19.02.2007 03:47 Thank you! I forgot about this case
The first compatible pair when there is no pair greater than (p,q) is ('000000....00' , '0000000...00' ) , isn't it ? I got WA test 22nd , please help me a bit . Isn't correct answer for test INPUT: 2 01 10 OUTPUT: 1 0 Instead of 10 00 Cause 1 < 10 and I don't see that anywhere is written that the pair of sequences (a,b) should be the same length as (p,q) Are there sequences p and q compatible? UPD: Sorry, first time I misunderstood the question Edited by author 18.02.2007 15:34 I think, in test #3 they are not |
|
|