Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Data type | Igor Parfenov | 1276. Train | 2 Feb 2023 04:16 | 1 | There were mentioned, that it is required 64-bit integer type. I also add, that it has to be unsigned, otherwise you get WA 8. | | WA 39 | Steven | 1774. Barber of the Army of Mages | 1 Feb 2023 19:37 | 8 | WA 39 Steven 5 Apr 2011 15:49 Can somebody give me anti-greedy tests so that a greedy solution will not give correct answer? A test like #39? I'm sure that greedy is the right solution, i cannot find counter-test for my solution. Re: WA 39 Milanka Halilovich 8 Apr 2011 15:50 I have same problem... Try: 3 1 1 6 3 2 2 4 Re: WA 39 Milanka Halilovich 8 Apr 2011 17:17 ..or.. 3 1 2 4 3 2 0 4 Edited by author 08.04.2011 17:18 I have same problem and my program works for this input (both R possible, correct me if I'm wrong) and I would appreciate if someone would suggest why program is not working and/or give me more tests like #39. Edited by author 24.04.2011 02:46 Same problem... Can somebody give us some tests? Try this: 5 2 0 3 3 2 3 2 0 2 0 5 This one is also nice: 4 2 0 3 1 2 2 2 1 4 Great thanks to @BSoD Edited by author 01.02.2023 19:37 Edited by author 01.02.2023 19:37 | | Test 6 format | Igor Parfenov | 1248. Sequence Sum | 31 Jan 2023 04:38 | 1 | Guess, why I had wasted 18 attempts? The exponent can have + sign: 1.3e+32 All bad wished to author. | | wa5. Why? | Kutnyakov | 1005. Stone Pile | 28 Jan 2023 12:25 | 2 | #include <iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, a, razn, k1 = 0, k2 = 0; cin >> n; vector<int>num; for (int i = 0; i < n; i++) { cin >> a; num.push_back(a); } sort(num.begin(), num.end()); int kol = 0; for (int i = 0; i < n - 1; i++) {//все камни кроме максимума kol += num[i]; } if (kol < num.back()) {//если все камни меньше самого максимального cout << num.back() - kol; } else if (kol == num.back()) {//если все камни pавны максимальному cout << 0; } else if (kol > num.back()) {//если все камни больше максимального k2 = num.back(); for(int i =n-2;i>=0;i--){ if (k1 < k2) { k1 += num[i]; } else if (k1 > k2) { k2 += num[i]; } else if (k1 == k2) { k1 = num[i]; k2 = 0; } } cout << abs(k1 - k2); } } //my program is fine solves any of my values. what is in test 5? здесь надо делать перебор битовыми масками Edited by author 28.01.2023 12:25 | | WA 6, python 3.8, plz help me | klimvetoshkin | 1263. Elections | 28 Jan 2023 11:58 | 1 | n, m = map(int, input().split()) a = [] b = [1] c = [] for i in range(m): f = int(input()) a.append(f) a = sorted(a) f = 0 for i in range(1, len(a)): if a[i] == a[i - 1]: b[f] += 1 elif a[i] != a[i - 1]: b.append(1) f += 1 for i in range(len(b)): b[i] = float(b[i] / m * 100) for i in range(len(b)): c.append('%.2f' % b[i] + '%') for i in range(n): try: print(c[i]) except: print('0.00%') | | Post the answer in java plz | Shemakin | 1209. 1, 10, 100, 1000... | 25 Jan 2023 13:16 | 1 | If my teacher is watching this post, sorry. | | Advice for bruteforce | andreyDagger`~ | 1234. Bricks | 25 Jan 2023 01:47 | 1 | Bruteforcing length gives WA, bruteforcing angle gives AC | | wrong answer(python) | dkzzum | 1404. Easy to Hack! | 25 Jan 2023 01:44 | 1 | I checked several times and everything is working correctly, help me def encryption(txt): cipher = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
encryption_list = [] for i in txt: encryption_list.append(cipher[i]) c = d = c1 = 0 encryption_last_list = [] for i in encryption_list: if d == 0: d += 1 c = i i -= 5
if i < 0: i = 25 - abs(i) encryption_last_list.append(i)
else: c1 = i i -= c c = c1 if i < 0: i = 26 - abs(i) encryption_last_list.append(i)
decodding_list = [] for i in encryption_last_list: for k, v in cipher.items(): if v == i: decodding_list.append(k)
return decodding_list text = input() if len(text) <= 99: c = '' output = encryption(text.lower()) for i in output: c += i print(c) | | i need help on Lonesome Knight ( coordinate sol) | roseiris | 1197. Lonesome Knight | 24 Jan 2023 20:45 | 1 | can anyone please explain the solution which uses the coordinates i think ... Edited by author 24.01.2023 20:46 Edited by author 24.01.2023 20:46 Edited by author 24.01.2023 20:46 | | A Question | lasercat | 1292. Mars Space Stations | 24 Jan 2023 09:55 | 2 | I get WA 1 with calculating distance in this way for(int i=0;i<len;i++) { ans+=pow(((int)(buf[i]-'0')),3); } while accepted in this way for(int i=0;i<len;i++) { ans+=(buf[i]-'0')*(buf[i]-'0')*(buf[i]-'0'); } WHY?!!!! Is this a bug on judge or bug in function?!! the compiler is g++ why not try this ans+=round(pow(((int)(buf[i]-'0')),3)); | | Weird statement | Igor Parfenov | 1282. Game Tree | 22 Jan 2023 02:48 | 1 | Notice, that +1 and -1 mean not victory and defeat states. INPUT 2 L 1 +1 OUTPUT +1 | | WA23 | andreyDagger`~ | 1630. Talisman | 21 Jan 2023 02:11 | 1 | WA23 andreyDagger`~ 21 Jan 2023 02:11 4 3 1 2 2 3 3 4 Luck is possible | | hint for all test case | Almas Turganbayev | 1083. Factorials!!! | 19 Jan 2023 16:22 | 1 | be attentive with loop (while)! we know formule n - x * k =) and in depends of number parity condition will be >= (ex. [n - x * k >= n mod k] or [n - x * k >= k]). Good luck!) Edited by author 19.01.2023 16:23 | | WA3: possible scenarios | Malak | 2115. The Knowledge Day | 17 Jan 2023 21:12 | 3 | Can anyone check if I missed any scenario ? 1, 2, 3, 4, 5 => Nothing to do here" 5, 4, 3, 2, 1 => Nothing to do here" 5, 2, 3, 4, 1 => "Yes\n1 5" 1, 8, 3, 4, 5, 6, 7, 2, 9 => "Yes\n2 8" 1, 8, 7, 6, 5, 4, 3, 2, 9 => "Yes\n1 9" 9, 8, 3, 6, 5, 4, 7, 2, 1 => "Yes\n3 7" 1 => Nothing to do here" 1, 1, 1, 1, 1 => "Nothing to do here" 9, 2, 3, 5, 4, 6, 7, 8, 1 => "No hope" 1, 2, 3, 9, 5, 6, 7 => "No hope" 7, 6, 5, 9, 3, 2, 1 => "No hope" 1, 1 => "Nothing to do here" 1, 2 => "Nothing to do here" 1, 2, 4, 3, 5, 6 => "Yes\n3 4" 6, 5, 3, 4, 2, 1 => "Yes\n3 4" 2, 1, 3 => "Yes\n1 2" 1, 3, 2 => "Yes\n2 3" 1, 2, 3, 2, 3, 4, 5 => "Yes\n3 4" 1, 5, 7, 2, 4, 5 => "No hope" If there are repeated digits, make sure you switch the right one. For example: 5 2 1 1 1 3 Try to generate tests containing a lot of same numbers, e.g. the next test: 9 1 5 1 3 3 3 5 1 5 has answer: Yes 2 8 | | Some tests | ~ SiriuS ~ | 2140. BitMazeCraft | 17 Jan 2023 10:39 | 3 | WA-3: 1 2 3 .# #. .. 1 1 1 1 1 3 ----- NO WA-12: 3 3 3 .#. ... ... ..# ... ..# ... ... ... 1 2 2 3 3 3 ----- YES 2 climb east jump south WA-108: 1 1 1 . 1 1 1 1 1 1 ---- YES 0 Edited by author 11.08.2022 10:30 WA-3: 3 4 2 .#.. .#.. .#.. .... .... .... 1 1 1 3 4 1 ----- YES 5 walk south walk south climb east drop east walk east | | Interesting observation (together with a suggestion) | Ramil | 1394. Ships. Version 2 | 16 Jan 2023 03:00 | 3 | Interesting that test48, test70 (with reservations) and test80 do not look so hard to my solution. At least if the commenters in previous threads were right with examples of these tests. But mysterious test30 and test31 - I don't even imagine what structure they got. Test70 is "randomly" solvable: with time distributed between 0.3 and 2.9 seconds (with avg = 1.1 sec) on my Intel i5-9400 (by "randomly" - I mean, of course, that could be 2.9 seconds which is TLE and would not pass) And my suggestion: It would be nice to have a separate section on the site with parallel running of tests for such hard computational tasks. I mean: maybe someone also passes test 70, but fails test 30, for example. And the total percentage: passed N tests, failed tests with numbers K, L, M Now I know what's been wrong with my solution (TLE30), but now TLE46 If you read SPb-MaxBuzz's article about test generation for the problem, then you can see tests rearranged intentionally for top of solutions at some time point in the past. You can think your solution is very special. | | How to divide over non prime modulo | andreyDagger`~ | 1749. Periodic Sum | 15 Jan 2023 02:26 | 1 | | | Some tests | Tunez(ITMO) | 1006. Square Frames | 14 Jan 2023 23:39 | 2 | .................................................. .......................┌──────┐................... .......................│......│................... .......................│......│................... .......................│......│................... .......................│......│................... .......................│......│................... ┌────────┐.............│......│................... │........│.............└──────┘................... │........│........................................ │........│........................................ │─────┐..│........................................ │.....│..│........................................ │.....│..│........................................ │.....│..│..............┌──┐...................... │.....│..│..............│..│...................... └────────┘..............│..│...................... └─────┘.................└──┘...................... .................................................. .................................................. .................................┌┐............... .................................└┘............... ..┌──────┐.................................┌─────┐ ..│......│........┌────────┐...............│.....│ ..│......│........│........│...............│.....│ ..│......│........│........│...┌───┐.......│.....│ ..│.┌───┐│........│........│...│...│.......│.....│ ..│.│┌──││───┐....│........│..┌│──┐│.......│.....│ ..│.││..││...│....│........│..││..││.......└─────┘ .┌└─│───│┘┐..│....│........│..┌─┐──┘.............. .┌──└───┘.│..│....│........│..│.│.│............... .│...││...│..│┌─────┐......│..└─┘─┘............... .│...││...│..││...└─│──────┘...┌───┐.............. .│...││...│..││.....│..........│...│.............. .│...││...│..││.....│..........│...│.............. .└────┘──────┘│.....│........┌───┐.│.............. .│........│...│.....│........│.└─│─┘.............. .│........│...└─────┘........│..┌│................ .└────────┘..................│..└│................ .............................└───┘................ .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ..........┌─┐─┌─┐................................. ..........│.│.│.│................................. ..........┌─────┐................................. ..........│.....│................................. ..........│.....│................................. ..........│.....│.....................┌┌┐......... ..........│.....│.....................┌┐┐......... ..........│.....│.....................└┘┘......... ..........└─────┘................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ..┌┐.............................................. ..└┌┐┌┐........................................... ...└┌└┘........................................... ....└┘............................................ .................................................. .................................................. ...............................┌┌┌┐┐┐............. ...............................└└└┘┘┘............. .....┌───┐........................................ .....│┘─└│........................................ .....││.││........................................ .....│┐─┌│........................................ .....└───┘........................................ .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ┌┌──┌┌──┐────┐┐───┌┐─┌───────┐─┌─────┌──┐┐───┌───┐ ┌│──│││││─│──│──┌─────────┐───┐┌────┐─┐┌││┐││││┐┐│ │││││││┌│────│──┌────┐─┘──││││││┌─────────┐──││──│ ││┌┌│└──┘─│─┌│┐─││││││││││││┌─│││││─││││┘│││─││─││ │┌──┌──┐──┘─┌───│──┐─│─┐──│┌───││┐│┐│─│───│┌─────┐ └│──││││││┌─│││─││┐│─│┐│└┌││──┘│││──││││││││──┘│││ └│──│──││─│┌────│──┐││││┌┐│││┌─└│───┘│││┌─││─────│ ┌│││└──┘┌─└│││──└────┘││└┘│││││┌││└─│─│┘│─││────┘│ ┌│┐││─┐│││││││││││││┌─┐│──││─│││││─┐││││││││││││││ │││─└──────││┘│┌│││││─││─┌││└│└─││──│─┘│││││─┐│┘││ └└─────││││││─│└││││└─┘│──│└────│┘││││─││┘│└─────┘ │││││││││─││└──────│──────┘└─│──│──┌│───┌──────┐─│ └─┘┌│┌─└│──│─────┌─│──┐│───┘┌└─┌└───────│─┘│┘│││││ ││└││││││└└│──┐──│─│──│┘─│└──│─│││││││─│││││─┌││─┐ ││┌─│┌──│─┐└───────┘││││││─│││┌│┐│││││││││││─└││││ ┌──┐││┘││││││─┌┐││─│││││┌┐─││││││││││──┘││───│││─│ ││└│└───└──└──└┘─│─└──││└┘──││└│┘│││││─┘│└────┘│││ │└└│─│┘─│││││──││└────┘│─┘─││└─└───└────│──┘┌└─│─┘ └──┘─│└─││││└───│──│──┘│────│─┘│─└─┘──┘─└──────┘─┘ └────└────┘└────└──────┘────└──────┘┘┘───└┘─┘─┘┘└┘ Edited by author 08.09.2019 16:59 Edited by author 08.09.2019 17:01 Edited by author 08.09.2019 17:01 Edited by author 08.09.2019 17:06 Edited by author 08.09.2019 17:06 Edited by author 08.09.2019 17:07 Edited by author 08.09.2019 17:07 Edited by author 08.09.2019 17:15 Wow! The last one is not with 15 square frames, but you did a great job! Thanx! | | WA #10 , can you help me??? | datct0407 | 1495. One-two, One-two 2 | 13 Jan 2023 15:16 | 4 | #include <stdio.h> #define maxn 1000001 long n; short result[31],b[maxn]; int tr[maxn]; long count,i,j; main() { scanf("%ld",&n); for (i=0;i<n;i++) b[i]=0; b[1%n]=1; tr[1%n]=0; if (n!=1) b[2%n]=2; tr[2%n]=0; count=1; while (b[0]==0 && count <30) { count++; for (i=1;i<n;i++) if (b[i]!=0) { if (b[(i*10+1)%n]==0) { b[(i*10+1)%n]=1; tr[(i*10+1)%n]=i; }; if (b[(i*10+2)%n]==0) { b[(i*10+2)%n]=2; tr[(i*10+2)%n]=i; }; } } if (b[0]==0) { printf("Impossible"); } else { i=0; j=1; result[j]=b[i]; while (tr[i]!=0) { i=tr[i]; j++; result[j]=b[i]; } for (i=j;i>0;i--) printf("%d",result[i]); } getchar(); } When i had wa 10 i found out that my solution on test like 101 gives me 1212 instead of 1111. It doesnt helped me on this test, but i found mistake anyway | | What's wrong with my codes?It WA at 8 | wshxzt | 1282. Game Tree | 13 Jan 2023 12:56 | 3 | var f,q,be:array[0..1000] of integer; n,x,a,b,c:integer; m:char; begin {assign(input,'1282.txt'); reset(input); } readln(n); for x:=1 to n do be[x]:=-3; for x:=2 to n do begin read(m); if m='L' then begin readln(a,b); if be[a]=-3 then begin inc(c); q[c]:=a; be[a]:=-1; end; if b=-1 then be[a]:=1; if (b=0) and (be[a]<0) then be[a]:=0; end else readln(f[x]); end; b:=1; while q[b]<>1 do begin if be[f[q[b]]]<-2 then begin inc(c); q[c]:=f[q[b]]; be[f[q[b]]]:=-1; end; if be[q[b]]=-1 then be[f[q[b]]]:=1; if (be[q[b]]=0) and (be[f[q[b]]]<0) then be[f[q[b]]]:=0; inc(b); end; if be[1]=1 then writeln('+1') else writeln(be[1]); end. {be[n]==the best value it then player play best f[n]==the father of n be[n]=-3===>it hasn't been visited } Read these sentences carefully: The leaf nodes of the tree of this game may have values equal to one of three numbers: “+1” – victory of the first competitor, “–1” – victory of the second competitor, “0” – draw. For example, Input 3 L 1 +1 L 1 +1 Output +1 Input 3 L 1 +1 L 1 -1 Output +1 Input 3 L 1 -1 L 1 -1 Output -1 Hope it can help:) |
|
|