Common Board| Show all threads Hide all threads Show all messages Hide all messages | | This should be enough to get AC without thinking | Gilles Deleuze | 1459. Archer's Travel | 16 Jan 2020 16:28 | 1 | vector<vector<int64_t>> sequence = { {1,1,1,1,1,1,1,1,1,1,1,1}, {1,0,2,0,4,0,8,0,16,0,32,0}, {1,2,6,14,37,92,236,596,1517,3846,9770,24794}, // next is 62953 {1,0,14,0,154,0,1696,0,18684,0,205832,0}, // next is 2267544 }; The solution is a linear recurrence. Output is multiplied by 2. Edited by author 16.01.2020 16:32 | | WA32 | АРТЕМ | 1877. Bicycle Codes | 15 Jan 2020 02:50 | 1 | WA32 АРТЕМ 15 Jan 2020 02:50 I wrote a stupid solution and got wa32. Help please! | | If blossom's writer gets WA12 ... | Mickkie | 1099. Work Scheduling | 13 Jan 2020 22:19 | 2 | In my case this test may help you 16 19 1 2 2 3 3 4 4 5 5 1 1 6 6 7 7 8 8 9 9 10 10 6 5 11 11 12 12 13 13 4 3 14 14 15 15 16 16 2 The sequence of contraction affects the solution if you do not repeat the process after release the blossom. if you contract (6,7,8,9,10), (4,5,11,12,13), (2,3,14,15,16) first you get maximum matching. but if you contract (1,2,3,4,5) first and don't repeat the process after release it you don't get to the maximum. Hope this helps. Thank you for this case! I didn't realize that the blossoms should be reset in each iteration. | | No subject | Andrew | 1785. Lost in Localization | 13 Jan 2020 18:12 | 1 | Edited by author 13.01.2020 19:23 Edited by author 13.01.2020 19:23 | | GDE OWIBKA ? (JAVA) | shaihin | 1493. One Step from Happiness | 13 Jan 2020 16:53 | 4 | import java.util.*; public class LuckyNumber{ public static void main(String args[]){ Scanner in = new Scanner(System.in); int x = in.nextInt(); int a1,a2,a3,b1,b2,b3; a1 = x/100000; a2 = (x/10000)%10; a3 = (x/1000)%10; b1 = (x/100)%10; b2 = (x/10)%10; b3 = x%10; if((a1+a2+a3) == (b1+b2+b3)) System.out.println("Lucky Number"); else if(a1+a2+a3-(b1+b2+b3)>1 ||(b1+b2+b3)-(a1+a2+a3)>1) { System.out.println("prostoi bilet"); } else System.out.println("Lucky Number budet sleduwii ili prediduwi bilet"); } } You should output "Yes" or "No" and nothing else | | Wrong AC | VorivaN[Yaroslavl SU]🔥 | 2144. Cleaning the Room | 12 Jan 2020 21:48 | 1 | Wrong AC VorivaN[Yaroslavl SU]🔥 12 Jan 2020 21:48 Input: 2 2 1 2 2 1 2 My output: YES Answer: NO Rejudge pls! | | WA 1 | aslan7470 | 1452. Pascal vs. C++ | 12 Jan 2020 15:48 | 2 | WA 1 aslan7470 14 Mar 2015 01:44 On #1 test my program output: 4 4 5 1 6 with code: cout<<4<<endl<<4<<" "<<5<<" "<<1<<" "<<6 but get wrong answer. Why? Re: WA 1 Alikhan Zimanov 12 Jan 2020 15:48 Because the first test is NOT the same as the sample | | WA 5, Help | Toshpulatov (MSU Tashkent) | 2119. Tree Hull | 11 Jan 2020 12:15 | 2 | WA 5, Help Toshpulatov (MSU Tashkent) 11 Jan 2020 02:07 TEST 10 1 7 1 1 8 1 1 2 1 7 10 1 7 9 1 9 3 1 8 4 1 2 5 1 5 6 1 6 + 10 + 1 + 2 + 8 + 3 + 6 ans = 8 | | Python3 TLE 4 test | Desserg | 2018. The Debut Album | 10 Jan 2020 16:34 | 2 | if test 50000 300 300 My solution takes about 1.9 seconds (time library). the test fails. almost all the time spent on summarizing lists: "ncalls tottime percall cumtime percall filename:lineno(function)" "99402 1.773 0.000 1.773 0.000 {built-in method builtins.sum}" Maybe there is a way to more quickly summarize than the built-in function "sum"? Edited by author 12.12.2019 15:42 Edited by author 12.12.2019 15:42 Edited by author 12.12.2019 15:42 You may recalculate total sum of list on every iteration, if that lists changes predictable for you. For example, if you shift you list to the left for one position, and add some other value, then you may substract that shifted value and add new one, thus you perform updation. | | getting wa 5. Please suggest some test cases | anupam ghosh | 2142. Magic | 9 Jan 2020 13:15 | 3 | 5 6 0 6 5 0 There are no miracles in life 6 5 0 5 6 0 There are no miracles in life 3 6 2 6 5 1 There are no miracles in life 4 6 2 6 5 1 It is a kind of magic | | WA11 | vtalgo16_plitvinov | 1366. Presents | 9 Jan 2020 03:09 | 2 | WA11 vtalgo16_plitvinov 29 Feb 2016 01:22 What is WA11? P.S. subfactorial func is correct P.P.S. Admins, is it possible there are some bugs here? Edited by author 29.02.2016 01:26 Re: WA11 Artem Maksunov 9 Jan 2020 03:09 | | WA18? | fatnot | 1424. Minibus | 8 Jan 2020 23:52 | 1 | WA18? fatnot 8 Jan 2020 23:52 How can i fix WA18? Im solving using greedy algo | | some test cases | reshke | 1758. Bald Spot Revisited 2 | 8 Jan 2020 19:42 | 1 | 50 39 1 33 11 22 44 4 28 14 42 21 7 35 5 25 50 10 20 40 8 32 16 48 24 12 36 18 6 30 15 45 9 27 3 39 13 26 2 34 17 21 17 1 16 8 4 20 10 5 15 3 9 18 6 12 2 14 7 21 | | please help me :( //// What is Test 10? /// thanks :) | s.mohsen | 1123. Salary | 8 Jan 2020 00:47 | 1 | | | Hotel - Trivago | n000 | 1319. Hotel | 7 Jan 2020 02:09 | 1 | | | What's your algo? | ACSpeed | 1604. Country of Fools | 5 Jan 2020 23:27 | 5 | Can you guys share your approach ( and proof if possible ) because mine, though AC, is not very certain. I rely on greedy approach which output pairs with maximum number and minimum number. Use sort and find min and max after output each pair. Quite slow, 0.14s :) Greedy approach is fine but why output pairs with maximum number and minimum number ?? Can you guys share your approach ( and proof if possible ) because mine, though AC, is not very certain. I rely on greedy approach which output pairs with maximum number and minimum number. Use sort and find min and max after output each pair. Quite slow, 0.14s :) I used a max heap in which I hold pairs like, number i (index of the sign) and frequency of that sign. Each time I pop out from that heap the 2 index with maximal frequency, decrement their frequency and update the heap from their indexes. I was sure that there is a more simplier aproach to that problem(like greedy), without using heap, but I was just 99.9% sure that with heap I will got AC, and so it was. :) The same here. I'm using heap, but I'm pulling entries one by one, decrementing and not adding them back until next entry is pulled. I was 146% sure this would work when I decided to implement this algo and it not that bad in terms of time: O(n log k). But I wondered if there is a simple straightforward algo that also would work. Turned out there is. I created an array of pairs (quantity, index) and sorted it. Output the maximum and the next one with a positive quantity, and if there are elements with the same quantity that remains at the maximum, I output them the same way, each step decreasing the number of the output element Sorry for my English tests with my answers: 4 8 5 4 3 1 2 1 2 1 2 1 2 1 2 3 1 3 4 1 3 4 1 3 4 5 9 7 4 4 3 1 2 1 2 1 2 1 2 1 2 1 2 4 3 1 2 4 3 5 1 4 3 5 1 4 3 5 | | WA 20 | vtalgo19_manisimova | 1604. Country of Fools | 5 Jan 2020 22:45 | 2 | WA 20 vtalgo19_manisimova 23 Apr 2019 14:58 Test 3 3 3 3 3 1 2 7 5 7 5 4 1 1 Edited by author 05.01.2020 22:51 Edited by author 05.01.2020 23:18 | | If you have WA5 | SButterfly [Samara SAU] | 1987. Nested Segments | 5 Jan 2020 19:55 | 3 | Try this test: 5 2 10 2 4 3 4 6 9 7 8 11 1 2 3 4 5 6 7 8 9 10 11 Answer: -1 2 3 3 1 4 5 5 4 1 -1 Try this test: 5 2 10 2 4 3 4 6 9 7 8 11 1 2 3 4 5 6 7 8 9 10 11 Answer: -1 2 3 3 1 4 5 5 4 1 -1 My code passes this test... Still getting WA5. The following test helped me to get AC: 7 2 8 2 6 3 3 6 6 7 7 8 8 9 10 10 1 2 3 4 5 6 7 8 9 10 Answer: -1 2 3 2 2 4 5 6 7 7 I used points sorting + stack approach. My error was in sorting function: I didn't handle situation when points have the same coordinates, the same types, but belong to different segments. Once I added condition which deals with segment numbers, I got AC. By the way, different compilers may give different results: my program compiled with visual studio gave correct results, while g++ did not. Edited by author 05.01.2020 20:01 | | Anyone can tell me why is not working? (Test 4 Wrong answer) | Claudiu | 2018. The Debut Album | 4 Jan 2020 18:02 | 1 | #include <iostream> using namespace std; long long maxi,sum=1,sum1=1,n,a,b,i,v[100000],v1[100000]; int main() { cin>>n>>a>>b; if(a>b) maxi=a; else maxi=b; v[maxi]=1; v1[maxi]=1; for(i=maxi+1;i<n+maxi;i++) { v[i]=sum1; v1[i]=sum; sum=sum+v[i]-v[i-a]; sum1=sum1+v1[i]-v1[i-b]; } cout<<sum+sum1; return 0; } | | WA #7 | Tranvick | 1577. E-mail | 3 Jan 2020 16:42 | 3 | WA #7 Tranvick 13 Dec 2011 16:56 What's this test?? My code: #include <string> #include <algorithm> #include <iostream> #define N 2222 #define MOD 1000000007ll using namespace std; long long f[N][N],d[N][N]; int n,m; string s1,s2; void init(){ getline(cin,s1); getline(cin,s2); n=s1.length(),m=s2.length(); } int main(){ init(); for (int i=0;i<=n;i++) d[i][0]=i; for (int i=0;i<=m;i++) d[0][i]=i; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (s1[i-1]==s2[j-1]) d[i][j]=d[i-1][j-1]+1; else d[i][j]=min(d[i-1][j],d[i][j-1])+1; for (int i=0;i<=n;i++) f[i][0]=1; for (int i=0;i<=m;i++) f[0][i]=1; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){ if (d[i][j]==i || d[i][j]==j) f[i][j]=1; else{ if (s1[i-1]==s2[j-1]) f[i][j]=f[i-1][j-1]; else f[i][j]=f[i-1][j]+f[i][j-1]; } f[i][j]%=MOD; } cout<<f[n][m]<<endl; } You can try this: dcfc dbf Answer:2 LOL, replying after 7 years. |
|
|