| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| any algo | Ibragim Atadjanov (Tashkent U of IT) | 1805. Чапаев и шифровальная решётка | 10 авг 2022 11:56 | 8 |
any algo Ibragim Atadjanov (Tashkent U of IT) 12 ноя 2010 10:57 Who know how to solve it. I think all the varians will be 4^(9 + 7 + 5 + 3 + 1) = 4^25 when n = 10. So i cannot count from 1st to kth variant Re: any algo Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 12 ноя 2010 13:56 O(N^4) simple algo exists. Re: any algo Ibragim Atadjanov (Tashkent U of IT) 13 ноя 2010 18:52 Can you tell anything else? I mean is the algo search(Binary Search or smth else). Please give me a clue Re: any algo Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 13 ноя 2010 22:49 Suppose you have already built a part of a grille and is thinking what symbol is to put in the following cell. Can you count the number of grilles which can be built with such a beginning and symbol? I suppose that O(n^2) algorithm is even more simple. Both in inventing and coding. That's right. I track amount of remaining variations for every cycle and their total product. This information is enough at each of N^2 steps to decide if it should be '0' or '1' Given advices too weak to be helpfull. For me key idea was forming n*n/4 classes with 4 cell in each and working with level, where 1<=level<=n*n; We counting all combinations under level in each classes exept whose are used already. Re: any algo Strekalovsky Oleg [Vologda SPU #1] 8 ноя 2011 00:01 Given advices too weak to be helpfull. For me key idea was forming n*n/4 classes with 4 cell in each and working with level, where 1<=level<=n*n; We counting all combinations under level in each classes exept whose are used already. My algo was same as Vedernikoff 'Goryinyich' Sergey (HSE: АОП) said. Algo is very simple and wasn't too hard to implement. Edited by author 08.11.2011 00:01 |
| Тут же можно решить вообще не используя double ! | Toshpulatov (MSU Tashkent) | 1875. Angry Birds | 10 авг 2022 09:04 | 2 |
And also not using G constant :) |
| Anyone greedy? | alexradu04 | 1570. Ужин на 45 этаже | 9 авг 2022 23:15 | 2 |
I was wondering if there was a greedy solution to this problem help please. Yes, there is after preliminary DP for min-price-allowed-steps-graph. |
| Complexity | Infoshoc | 1570. Ужин на 45 этаже | 9 авг 2022 23:13 | 2 |
Solved with O(n * (m+max("filling value")) * 10^3). Anyone better? Strange thing: seems like in tests 15-16 max("filling value") is good deal smaller than 10.0, because O(n * (m+10) * 10^3) failed. There is 30000*100 solution O(filling X dishes) |
| when it may be «It is a lie!». | McArchuk | 1731. Укроп | 8 авг 2022 11:12 | 6 |
when it may be «It is a lie!». Edited by author 08.08.2022 11:27 |
| WA10 | markopetkovic359 | 1580. Долги декана | 8 авг 2022 09:20 | 4 |
WA10 markopetkovic359 4 апр 2010 08:23 Does anybody have an idea ? Edited by author 04.04.2010 08:24 6 6 1 2 1 2 3 2 3 1 3 4 5 1 5 6 2 6 4 3 Thanks. Was my bug as well (forgot that there can be more than one connected component). |
| Hint | Harkonnen | 1780. Код Грея | 8 авг 2022 00:13 | 1 |
Hint Harkonnen 8 авг 2022 00:13 Solution is pretty straightforward based on parity and bit position, but to avoid all those position reflections in your head during coding, generate codes for say N=5 and look at value of "k XOR x" |
| why i always get "Runtime error (access violation)" on the test №1? | vicodin | 1033. Лабиринт | 7 авг 2022 13:12 | 1 |
i found mistake :) Edited by author 07.08.2022 13:48 |
| Are there beautifull solution? | Joseph Puh the Battle Bear | 1578. Охота на мамонта | 7 авг 2022 12:22 | 3 |
Are there beautifull solution? The one other from bruteforce Yes, there are exists one very beautiful O(N^2) solution. But the practical complexity of this algo is much less :) There is also almost O(N) solution, but that's due to weak tests (probably there is a proof that N*log(N)) is enough. Just go forward and swap vertices if they form non-acute angle (that's WA14). Then go backward and do the same (that's WA22). Then do that in a loop 10 times back and forth, and get weak AC :) P.S: Even 2 such passes is enough (no proof, just such tests). And I think there is a proof that N passes is always enough. Edited by author 07.08.2022 12:28 Edited by author 07.08.2022 12:30 |
| Is there faster solution | DarksideCoder | 2129. Ипотека в Тридевятом Царстве | 7 авг 2022 09:47 | 3 |
My solution is O(tl^3logn) , but its performance is good. could you describe your solution? my algo O(logn * l^3 * t) has TL( i try to find solution like this: dp[i, a, l] , i is bit number, a is addition to i-bit, l is lost count Yes, there is. (L^2)*log(N) solution (0.187 sec). I DP on total amount of coins and amount of extra coins for next denomination (the latter is used to know how much more can I push forward when I advance a digit). The first index always increases by K-1, the second always increases by K, so it's kind of diagonal partial summing up matrix to itself. If you precalculate reachable sums properly, you can perform DP transfer in O(L^2). |
| Accepted in C++ | sh6rlock | 1068. Сумма | 3 авг 2022 20:20 | 1 |
#include<bits/stdc++.h> #include<math.h> using namespace std; int main() { int N, sum = 0; cin>> N; if(N > 0) { for(int i = 1; i <= N; i++) { sum = sum + i; } } else if(N <= 0) { for(int i = N; i <= 1; i++) { sum = sum + i; } } cout<< sum << endl; return 0; } |
| Memory limit at test 4. Python | Vsevolod | 1048. Сверхдлинные суммы | 2 авг 2022 16:44 | 1 |
a=int(input()) b=0 for i in range(a): n,l=map(int, input().split()) b=b*10+n+l print('0'*(a-len(str(b))),b, sep='') |
| On G++ we can use __int128 | Igor Parfenov | 1133. Последовательность Фибоначчи | 1 авг 2022 02:14 | 1 |
If you calculate with formulas, then long long is not enough. You can use __int128. You can't read and write it, but you can cast it to and from other integer types. |
| Realy strange problem (SPOILER) | andreyDagger`~ | 1360. Философский спор | 28 июл 2022 20:32 | 1 |
Bruteforcing in range [0, 4e7] gives WA9, bruteforcing in range [1e8-4e7,1e8] gives AC Edited by author 28.07.2022 20:34 |
| Can anyone tell me whats wrong with this code | Programmer | 1021. Таинство суммы | 26 июл 2022 16:00 | 1 |
#include <bits/stdc++.h> using namespace std; int main(){ int n1,n2; int a[n1],b[n2]; cin>>n1; for(int k=0;k<n1;k++) cin>>a[k]; cin>>n2; for(int k=0;k<n2;k++) cin>>b[k]; sort(a,a+n1); sort(b,b+n2); int i=0,j=n2-1; bool ans=false; while(i<n1&&j>=0){ if(a[i]+b[j]==10000){ ans=true; break; } else if(a[i]+b[j]>10000){ j--; } else{ i++; } } if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; } |
| Problem 1010. Discrete Function [why i am getting wrong test case passing] | Amish jha | 1010. Дискретная функция | 23 июл 2022 22:08 | 1 |
/* :::: author:@DEANNOS at CODEFORCES 2022 :::: */ #include <bits/stdc++.h> //using policy based stl #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> using namespace std; #define endl "\n" #define mod 1000000007 #define ll long long #define ld long double #define vi vector<int> #define vll vector<ll> #define pll pair<ll, ll> #define pii pair<int, int> #define ld long double #define ff first #define ss second #define vs vector<string> #define vpll vector<pll> #define vb vector<bool> #define pb push_back #define bg begin() #define mp make_pair #define ed end() #define gi greater<int> () #define srt(v) (sort(all()) #define all(c) (c).begin(), (c).end() #define sz(x) (int)(x).size() #define fo(i,n) for(ll i=0;i<n;i++) #define Fo(i,k,n) for(ll i=k;i<n;i++) const int INF = 1000000000; const int MAX_N = 2e5; /* int fastpower(int x, int y, int mod) { int res = 1; x = x % mod; if (x == 0) { return 0; } while (y > 0) { if (y & 1) { res = (res*x) % mod; } y = y>>1; x = (x*x) % mod; } return res; } */ /* int GCD(int a,int b) { while(b!=0) { int rem=a%b; a=b; b=rem; } return a; } */ ll integer(ll a) { return a >= 0 ? a : -a; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; ll ans1 = 1, ans2 = 2, mx = 0; ll a; cin >> a; for (int i = 1; i < n; i++) { ll b; cin >> b; if (integr(a - b) > mx) { mx = integer(a - b); ans1 = i; ans2 = i + 1; } a = b; } cout << ans1 << ans2 << endl; return 0; } |
| Некорректное условие | Alexey Krupnitskiy | 1004. Экскурсия | 22 июл 2022 00:07 | 2 |
1. Вы пишите:найти для экскурсии кратчайший маршрут, начинающийся и заканчивающийся в одном и том же месте, т.е. количество перекрестков в маршруте должно быть N+1?. в след. абзаце: Все числа x1, …, xk должны быть различны. т.е. либо маршрут не должен заканчиваться на том же перекресте где начался либо должно быть дополнительное условие Х1=Хк. это принципиальная ошибка в условии. 2. пример который вы привели: 5 7 1 4 1 1 3 300 3 1 10 1 2 16 2 3 100 2 5 15 5 3 20 4 3 1 2 10 1 3 20 1 4 30 -1 дает результат: 1 3 5 2 No solution. а куда вы в первом тесте дели перекрестов №4? 3. Исходя из примера маршрут не должен содержать в себе все перекрестки? Ошибки очевидны. те решения, что вы приняли - частные, случайно полученные. Уточняйте условия и проверяйте свое решение. Edited by author 07.11.2014 13:33 Нужно найти минимальное кольцо графа. Но именно кольцо, то есть, охватывать не менее трёх перекрёстков. В первом тесте к 4му перекрёстку ведёт всего одна дорога, а значит, в ответ он в любом случае не попадает. |
| Условие | Davydes | 1004. Экскурсия | 22 июл 2022 00:02 | 3 |
Что-то я не совсем понял условие задачи. "M двусторонних дорог" - т.е. вроде как не ор. граф. Но пример и решение говорят, о том, что скорее это все таки ор. граф. 1 3 300 3 1 10 Так есть ориентация у ребер или нету? Написано, что возможно существование дорог, т.е. тебе нужно выбрать минимальную, а осталные проигнорировать. Два перекрёстка могут соединять несколько дорог. Но граф не ориентированный. |
| Very good test!!! | 10100 | 1004. Экскурсия | 21 июл 2022 23:34 | 3 |
6 6 1 2 1 1 3 1 2 3 10 4 5 2 4 6 2 6 5 2 -1 ANS: 4 5 6 I'm sorry, but it seems incorrect. You can go from 4 to 5 or from 4 to 6, but then you're locked. Please note that we have a directed graph. Why? You can move in both directions of road. |
| WA16 | andreyDagger`~ | 2090. Перекрёсток судьбы | 20 июл 2022 12:26 | 1 |
WA16 andreyDagger`~ 20 июл 2022 12:26 Don't calculate second probability, instead calculate probability that sergey will come to the cafe in the same time both on the first path and on the second. Using this probability you can easily calculate second answer |