| Show all threads Hide all threads Show all messages Hide all messages |
| Doubt in statement | Vaibhav | 1370. Magician | 5 Nov 2020 12:32 | 1 |
Are multiple '1' digits possible in the circle ? If yes , then will they produce separate click if they are currently in the window ? |
| Help me please | NegaTiv337 | 2102. Michael and Cryptography | 5 Nov 2020 03:21 | 1 |
Edited by author 05.11.2020 03:23 Edited by author 05.11.2020 03:23 Edited by author 05.11.2020 03:23 |
| Ready algorithm and all tests for lazy boys :) | mmd18cury | 1272. Non-Yekaterinburg Subway | 4 Nov 2020 21:19 | 1 |
http://e-maxx.ru/algo/connected_componentsYou need to output number of components minus 1. Tests: 4 4 0 3 4 1 2 3 1 2 4 0 1 0 0 0 6 0 0 5 6 5 1 1 2 1 4 2 5 3 6 4 5 1 2 1 6 5 0 1 2 1 4 2 5 3 6 4 5 1 6 3 4 1 2 2 3 4 5 2 6 4 0 1 3 3 4 4 6 5 6 1 Edited by author 04.11.2020 21:20 |
| What is test 23? | Alexandr | 2102. Michael and Cryptography | 3 Nov 2020 23:57 | 1 |
|
| Why correct output for given test case is not "kazak" ? | Vaibhav | 1297. Palindrome | 3 Nov 2020 15:25 | 3 |
longest palindromic substring is "kazak" itself. What am i missing ? It's case-sensitive. "Kazak" is not equal to "kazak"; 'K' is not equal to 'k' |
| no solution for n = 2 in network | wnik | 1349. Farm | 2 Nov 2020 17:37 | 1 |
WHYYYYY if u have same problem solution is 3 4 5 |
| Hint to solve this | Littel_John | 1607. Taxi | 2 Nov 2020 16:39 | 1 |
The key to solve is that : Driver won't take less than offered, and Petr won't pay more than asked. So if you using a loop for example in each step a will be always min(a + b, c) and c will always be max(c - d, a) |
| 2102, test 23 | Daniial | 2102. Michael and Cryptography | 2 Nov 2020 06:54 | 1 |
|
| Hint | Vineet Jain | 1098. Questions | 31 Oct 2020 21:23 | 1 |
Hint Vineet Jain 31 Oct 2020 21:23 Very Easy Josephus's problem. Look it on geek for geeks |
| Big Hint | coder | 1623. Fractal Labyrinth | 31 Oct 2020 16:44 | 1 |
Let 0,1,2,..N-1 - outer door N .. 2*N - 1 - 1-inner room doors 2*N .. 3N - 1 - 2-inner room doors .... i*N i*N + 1, .. i*N + N-1 - i-th room doors total (K+1)*N doors. W[i][j] - minimum dist from i to j-th door, where 0 <= i,j < (K+1)*N initially W[i][i] = 0, W[i][j] = inifinity for i <> j. read, and set W[i][j] = 1 if there exists road from i to j doors. ----------------- N times run following steps: 1. Floyd algorithm for 0.. (K+1)*N - 1 doors.
2. for 1<= t <= K , 0 <= i, j < N update W[t*N + i][ t*N + j] = min(W[t*N + i][t*N+j], W[i][j]) Because (t*N + i, t*N + j) - is identical path as outer (i,j) path.
Edited by author 31.10.2020 16:46 |
| some tests | Михаил Аршинов | 1929. Teddybears are not for Everyone | 30 Oct 2020 21:28 | 2 |
8 8 1 2 3 4 5 6 7 8 21 4 2 1 3 3 4 2 2 3 3 4 1 1 3 4 1 2 2 But n must be divisible by 3 |
| Much bigger C code but efficient I guess(Execution time:0.015sec;Memory:140 kB) | Fahim shahriyar | 1149. Sinus Dances | 29 Oct 2020 21:18 | 1 |
I have written the code the using user defined function thats why it has become much bigger. #include<Stdio.h> #include<math.h> int Sn(int n); int An(int a); int main() { int x; scanf("%d",&x); Sn(x); } int Sn(int n) { int j; if(n==1) {An(1); printf("+1");} else { for(j=1;j<n;j++) printf("("); for(j=1;j<=n;j++) {if(j==1) {An(j);printf("+%d)",n);} else if(j!=n) {An(j);printf("+%d)",n-j+1);} else {An(j);printf("+1");}}} } int An(int a) { int i,p; if(a==1) printf("sin(%d)",a); else {for(i=1;i<=a;i++) { p= pow(-1,i+1); if(i==1) printf("sin(%d",i); else if(p==1) printf("+sin(%d",i); else printf("-sin(%d",i);} for(i=0;i<a;i++) printf(")"); } } Edited by author 29.10.2020 21:19 |
| If you have WA36 | Nikolay Terenichev `~ | 2003. Simple Magic | 29 Oct 2020 20:31 | 2 |
Try this test: input: 1 8 output: 1 Oddly enough, my solution printed "infinity" in this simple case, but was successful with first 35 tests That is not a correct input,n >= 3. |
| AC on C++ | Arman Sykot | 1313. Some Words about Sport | 28 Oct 2020 21:11 | 1 |
/* * Author : Arman Sykot * Date & time : 28.10.2020 21:47:12 +06 */ #include <bits/stdc++.h> #define ll long long #define the_flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; int main() { the_flash; int n; cin >> n;
int arr[n][n];
for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cin >> arr[i][j]; }
for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { cout << arr[i - j][j] << " "; } }
for (int i = n; i < 2 * n - 1; i++) { for (int j = n - 1; j >= i - (n - 1); j--) cout << arr[j][i - j] << " "; }
cout << "\n";
return 0; } |
| OLE (probably 9) | kirdmiv | 1092. Transversal | 28 Oct 2020 20:49 | 1 |
If you are trying to flip signs on rectangles consider of using 1 request instead of many. :) |
| TLE#2 Python 3 | feather | 1086. Cryptography | 27 Oct 2020 23:37 | 1 |
o_o Edited by author 10.11.2020 12:55 |
| <-- TLE? Look here! --> | a | 1086. Cryptography | 27 Oct 2020 23:23 | 2 |
Hi everyone! If you are getting TLE in Test #2 or maybe another, I would like to give you a little help: -> Test #2 seems to give large numbers (like 15000), and it gives you those numbers in increasing order. Think about it. Now, if that isn't enogh, I can give you a little more help: -> Create an array / vector / list which will store the prime numbers you find. -> Create an algorithm that determines whether a number is prime or not (remember to only compare with odd numbers smaller than the square root of the number from which you are trying to figure out its primality). -> Create a function that calculates the n-th prime number. For that create a counter which increases everytime you find a new prime number and store that prime number in your array / vector / list. -> Finally, remember the thing I said at the beginning of this post! :D Hope it helps. :D since it's recent enough, that gives some hope... honestly, i've done all of listed above, and yet it gives TLE. i'm so done with this... please help... |
| Python 3 WA 5th test | feather | 1161. Stripies | 27 Oct 2020 22:24 | 1 |
i don't understand why. maybe somebody could help... here's the code from math import sqrt n=int(input()) l=0 a=[None]*n b=[None]*n for k in range(n): a[k]=int(input()) for z in range(n): p=0 for i in range(n): if a[i]>p: p=a[i] l=i b[z]=n-1-l a[l]=-a[l] for z in range(n): a[z]=-a[z] while n>1: n=n-1 a[b.index(n-1)]=2*sqrt(a[b.index(n)]*a[b.index(n-1)]) print('{:.2f}'.format(a[b[0]])) Edited by author 27.10.2020 23:40 |
| C++ will got you TLE on 9th test case if you are using string additions instead use python | Vineet Jain | 1012. K-based Numbers. Version 2 | 27 Oct 2020 07:17 | 1 |
|
| If you are having trouble | urmat | 1183. Brackets Sequence | 26 Oct 2020 22:19 | 1 |
dp[N][N] - minimum number of added brackets, ok[l][r] - is [l, r] already solved, vector<pair<char, int>> add[N][N] - what and where brackets should be added to [l][r], to make it balanced. make calc(l, r) function, if ok[l][r] then return dp[l][r], if(l == r) then add[l][r] = {{reversed(s[l]), l}} dp[l][r] = 1 if(l + 1 == r and s[l] matches s[r]) then dp[l][r] = 0 if(s[l] == s[r]) you update dp[l][r] with dp[l + 1][r - 1] or with dp[l][k] + dp[k + 1][r], take care of already balanced strings |