| Show all threads Hide all threads Show all messages Hide all messages |
| Don't waste your time to binary search without hash | Nikita Mogilevets | 1713. Key Substrings | 10 Jul 2017 19:06 | 2 |
I was trying to do the following. Construct suffix automation for each command. Binary search for length of each key substring. Binary search works as follows. For each substring of command of len (lower_bound+upper_bound) /2 check whether it is a substring of another command. And it was Time Limit Exceed #7. So, don't repeat yourself. Find better solution. Probably with suffix array, as posted on the webboard. |
| The problem is really evil. | Nikita Mogilevets | 1269. Obscene Words Filter | 10 Jul 2017 12:21 | 2 |
Check my submissions and learn how evil the problem is! Really tired trying to AC with Aho-Corasick. I would switch to suffix array and if not succeed to suffix tree. |
| STL is fast enough | Nikita Mogilevets | 1700. Awakening | 8 Jul 2017 23:54 | 1 |
Use unordered map and unordered set. max_load_factor(0.25) reserve (1<<x) |
| Need help | Gilles Deleuze | 1017. Staircases | 8 Jul 2017 16:20 | 2 |
Could someone explain this idea? tbl[0] = 1; for (int i = 1; i <= N; i++) { for (int j = N; j >= i ; j--) { tbl[j] += tbl[j-i]; } } cout<<tbl[N]-1<<endl; It is compressed 2-dimensional dynamic programming state. It is like we take staircase from 1,2,...,N cubes and add one more step. Subtract one to not count zero len staircase. Edited by author 08.07.2017 16:20 "Compressed " means that say dp[x] = Sum(dp[x] [i]) {i = 0,1,...,N} Edited by author 08.07.2017 16:20 Edited by author 08.07.2017 16:22 |
| I had a MLE 7 test - I split the tree into 3 parts - Accepted 0.593 | QProgS | 1269. Obscene Words Filter | 7 Jul 2017 21:04 | 3 |
I had a MLE 7 test - I split the tree into 3 parts And choose the best 3 answers Accepted 0.593 !!!! ------------------------- Enough for the division into 2 parts Edited by author 30.07.2011 10:18 sorry its late, but can you elaborate please ? I suppose he divided obscene words in three parts. Then did Aho - Corasick string matching algorithm for each of the parts separately. Edited by author 07.07.2017 21:05 |
| Wrong Answer #5 Some test please | Manflack | 1450. Russian Pipelines | 7 Jul 2017 00:10 | 1 |
#include <iostream> #include <vector> #include <queue> #define INF (1<<29) using namespace std; struct Arista { int hasta,costo; }; Arista armar(int h,int c) { Arista ar; ar.hasta=h; ar.costo=c; return ar; } struct Grafo { int suma=0; vector <vector <Arista>> adj; vector <int> dist; vector <bool> visitado; bool encontro=false; int nodos,aristas; int S,F; void leer() { cin >> nodos >> aristas; adj.resize(nodos+1); dist.resize(nodos+1,INF); visitado.resize(nodos+1,false); int desde,hasta,costo; for(int c=0; c<aristas; c++) { cin >> desde >> hasta >> costo; adj[desde].push_back(armar(hasta,costo)); } cin >> S >> F; dist[S]=0; } void bdfs(int nodo, int padre) { visitado[nodo]=true;
for(int c=0; c<adj[nodo].size(); c++) { int vecino=adj[nodo][c].hasta; int costo=adj[nodo][c].costo; if(dist[vecino]>dist[nodo]+costo&&visitado[vecino]==false) { dist[vecino]=dist[nodo]+costo; bdfs(vecino,nodo); } } } void start() { if(dist[F]<INF) cout << dist[F]; else cout << "No solution"; } }; int main() { Grafo g; g.leer(); g.bdfs(g.S,-1); g.start(); cout << endl; return 0; } BFS+DFS Some test, guys? |
| 31 palindorm | Dmitri | 2044. 31 Palindromes | 6 Jul 2017 15:11 | 1 |
j-1 bit must be 1 if prefix of the string could be cut by j palindroms. in notation 9-->1110 , but 9 must be 10000000, isn`t it??? |
| Amazing performance improvement when removed STL (C++) | Nikita Mogilevets | 1437. Gasoline Station | 6 Jul 2017 13:58 | 1 |
I was using QUEUE. It was Memory limit exceed #8 or something similar. Replaced queue by simple an static array of one million elements. I was using state struct. There are three members of unsigned char type. So, with C limitations, I got AC with 16 MB. |
| 1785. Трудности локализации Ruby 1.9 Time limit exceeded | Chernobuk | 1785. Lost in Localization | 5 Jul 2017 22:23 | 3 |
На руби вообще не имеет смысла что-то решать? Вы правы, думал несколько значений |
| to admins | endless suffering | 2035. Another Dress Rehearsal | 5 Jul 2017 11:49 | 1 |
add test x = y; x + y < c; x, y < c example input: 900000000 900000000 1000000000, i had AC with output 900000000 900000000 |
| I was using STL container to store inequal words | Nikita Mogilevets | 1941. Scary Martian Word | 5 Jul 2017 00:16 | 2 |
When I was using STD::SET and STD::MAP, it was TLE #18. When I switched to STD::UNORDERED_SET and STD::UNORDERED_MAP, it was ACCEPTED 0.6 sec 38 MB. I was using reserve (1<<16) and max load factor of 0.25. After replacing everything by STD::VECTOR Accepted 46 ms 15 MB |
| Test 2 WA ?! | JuliM | 1005. Stone Pile | 4 Jul 2017 23:18 | 2 |
Hello, Does anybody know what is the 2nd test? I can't get my head round this issue. I don't know what is the second test I have Accepted status Because I am assuming that there is the only way to solve that task And this is BRUTE FORCE |
| ACM-contest system | Backs [Rogatnev Sergey] | | 4 Jul 2017 19:45 | 1 |
|
| Format of input | __Andrewy__ | 1941. Scary Martian Word | 4 Jul 2017 17:50 | 2 |
Братаны-кодеры в этой задаче нужен особый подход к считыванию Из условия неясно,какой формат,но пока что он следущий(.=пробел): ххх.ххх.ххх и т.д. ууу.ууу.ууу.ууу и т.д. Не используйте на Паскале eof,eoln. Часть моего говнокода: ... s:string[4]; ... len:=1; read(s); inc(c[90*90*(ord(s[1])-33)+90*(ord(s[2])-33)+(ord(s[3])-33)]); f:=length(s)=4; while f do begin inc(len); read(s); inc(c[90*90*(ord(s[1])-33)+90*(ord(s[2])-33)+(ord(s[3])-33)]); f:=length(s)=4; end; ... Timus is not an image board That is not 2ch or 4ch There is no need to use such words |
| If you have no idea know why memory limit exceed | Nikita Mogilevets | 1039. Anniversary Party | 3 Jul 2017 15:42 | 1 |
C++. I was using recursive DFS. vector <vector<int> >. I forgot to pass graph vector by reference and got MLE#8. After noticing that I am passing graph vector by value and simply adding an ampersand before vector name AC 1MB memory used. Edited by author 03.07.2017 15:43 |
| If you have WA6 | TheCrawfish | 2015. Zhenya moves from the dormitory | 3 Jul 2017 14:38 | 1 |
98000 3334 3334 1 25000 3333 3 1 97999 1 2 30000 1 2 25000 1 Answer - You should rent the apartment #1 alone. or You should rent the apartment #2 alone. or You should rent the apartment #3 alone. 21111 1111 7777 5 1111 7777 10000 6556 20000 3131 80000 2 76400 1 4 1 21110 6000 1 21111 6665 2 21111 1220 2 1110 0 Answer - You should rent the apartment #3 alone. 1001 1001 1001 1 1001 1 1 2 1001 1 Answer - You should rent the apartment #1 alone. I hope it can help. My program, which got WA 6, failed on this tests. |
| To authors | __Andrewy__ | 1974. Similar Tunes | 2 Jul 2017 19:52 | 1 |
My AC program gives the wrong answer on the test: 2 1A 1A 1 5 1B 1A 1A 1B 1B =>0.200000000 but rught answer 0.400000000 |
| I was trying to solve it using C++ | Nikita Mogilevets | 1248. Sequence Sum | 2 Jul 2017 18:30 | 1 |
I was trying C++ for several hours. Can't defeat test case No. 7. So, I gave up and got AC using Python Decimal module just after several minutes I stopped trying C++. It is bad I think that I don't solved with C++. Literally no idea why WA#7. I tried rounding and truncation. The result was always the same. |
| Why the answer in the first example is 02:00:00 25.00? | __Andrewy__ | 1154. Mages Contest | 2 Jul 2017 17:51 | 1 |
When time is 02:00:00 Good have power=58 and Evil=60 ((x-40)/(130-40)=7200/36000 => x=58). |
| You can simulate in with segment tree | Nikita Mogilevets | 1521. War Games 2 | 1 Jul 2017 20:50 | 1 |
In your segment tree you have count of zeros on every segment of vector of length N. Find k-th non-zero element. Then zero it. Update tree. Output. |