Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Memory limit in java | pilosofi | 1369. Тараканьи бега | 5 сен 2017 19:33 | 3 |
Can somebody tell me why i get memory limit exceeded in test case #9... ???? i make an k-d tree and use nearest neighbor search in my solution and still have memory limit Edited by author 03.05.2013 07:52 Have you done it? i have memory limit in test 10 too (c++) Have you done it? i have memory limit in test 9 too (c++) Edited by author 05.09.2017 19:58 Edited by author 05.09.2017 19:58 |
Test 5 WA5 | Aleksandr | 1074. Очень короткая задача | 5 сен 2017 15:14 | 1 |
Give me test#5? please!!! I tried all test from forum |
Kotlin Programming Language was added | Vladimir Yakovlev (USU) | | 5 сен 2017 02:57 | 1 |
Kotlin compiler version 1.1.4 was added. See http://acm.timus.ru/help.aspx?topic=kotlin for more details. Here is a sample solution for A+B Problem: fun main(args: Array<String>) { val (x, y) = readLine()!!.split(' ').map(String::toInt) println(x + y) } Edited by author 05.09.2017 02:57 |
WA1 java?! WTF | captainflint | 1074. Очень короткая задача | 5 сен 2017 01:21 | 2 |
On my PC it runs perfectly correct, the output is exactly the same(i have checked it using equals method so a mistake is impossible) but i get WA1 somehow. If somebody has an idea, please write it here. BTW I know that the first test is the sample test because a simple program that prints sample output gets WA2. PS here is my code if someone's interested: https://pastebin.com/SYiQTbMt Edited by author 04.09.2017 23:49 Edited by author 04.09.2017 23:49Do you think test case number one is the sample? |
If you have random fail... | ♫♫ Anastasiya | 1755. Торт | 4 сен 2017 16:52 | 1 |
Just try over and over again. My AC-program has wa when I try to submit it again. The same code has wa-1, wa-5, wa-7, wa-22, wa-30, ac, again wa... |
WA 20 | 💻Evgeny Nemtsev [UrFU FT-17]'` | 1630. Талисман | 3 сен 2017 18:54 | 1 |
WA 20 💻Evgeny Nemtsev [UrFU FT-17]'` 3 сен 2017 18:54 5 10 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5 -> Unlucky Petr |
It was hard to solve | Mahilewets Nikita [BSUIR] | 2072. Садовод Кирилл 3 | 3 сен 2017 17:01 | 1 |
I have solved it only after reading Felix Mate's comment about dynamic programming approach |
quicksort TLE#11; use heapsort instead and got AC | LLL | 1613. Для любителей статистики | 3 сен 2017 16:12 | 1 |
|
Python TLE | Mahilewets Nikita [BSUIR] | 1776. Праздничный фейерверк | 2 сен 2017 18:49 | 1 |
Python TLE Mahilewets Nikita [BSUIR] 2 сен 2017 18:49 Of course you can do precalculation and AC with Python But it is really hard to AC with Python with "online" calculation |
Test 54 | Ashiqul Islam | 1463. Радость населению! | 2 сен 2017 16:19 | 1 |
Test 54 Ashiqul Islam 2 сен 2017 16:19 What may be the test 54 ?? |
Please, what kind of test in #6 test? | T_e_n_Jl_bl_u | 1369. Тараканьи бега | 2 сен 2017 05:38 | 3 |
i try, but it isn't enough. give a hint, please (test #6) Edited by author 01.09.2017 07:46 What about test #9? every time Runtime error. what can be there? Edited by author 02.09.2017 05:39 |
Помогите пж, ошибка в 11 тесте | AlEkSeY~` | 1688. Team.GOV! | 1 сен 2017 23:03 | 1 |
#include <iostream> #include <cmath> #include <iomanip> #include <vector> #include<algorithm> using namespace std; int main() { long long a, c, d, min, max, n, x;
long double b, e, sum; cin >> a >> n; sum = 0; d = 0; vector<long long> z(n); for (long long i = 0; i < n ; ++i) { cin >> z[i]; } for (long long i = 0; i < n; ++i) {
b = z[i] / 3; sum = sum + b; d = d + 1; if (a < sum) { break; }
} if (a > sum) { cout << "Team.GOV!" << endl; } else { cout << "Free after " << d << " times." << endl; } return 0; } |
Nice new feature! | Mahilewets Nikita [BSUIR] | | 31 авг 2017 12:36 | 1 |
Thank you admins for nice new feature I am about additional information about task in forum Namely task name in addition to task number |
No Need To Use Loop, Only If can solve it | Sherxon WIUT | 2011. Длинное условие | 30 авг 2017 18:43 | 10 |
... Edited by author 06.12.2014 19:30 I solve without loop but is return WA#4 There is my algorithm : if in list has 1 , 2 , 3 together always "Yes" otherwise "No" am I right or any case is there ? Edited by author 09.08.2017 09:41 Edited by author 09.08.2017 09:42 You can get six combinations with two a's and two b's You can get six combinations with one a and five b's Sorry but I don't understand what do you mean ! Give me Test Case #4 0011 0101 0110 1001 1010 1100 That is six 000001 000010 000100 001000 010000 100000 That is also six 012 021 102 120 201 210 And that is six Answer is No , Correct ? 0011 0101 0110 1001 1010 1100 That is six |
idea | srevarun | 1385. Интересное число | 30 авг 2017 14:51 | 1 |
idea srevarun 30 авг 2017 14:51 Guys can anyone give any idea about how to solve this dynamically . |
WA 15 | LastOne | 1651. Кратчайшая подцепь | 30 авг 2017 08:51 | 2 |
WA 15 LastOne 30 авг 2017 07:49 Please help #include <bits/stdc++.h> using namespace std; const int infInt = 1<<30; vector<int>adj[100010]; pair<int,int> edges[100010]; int parent[100010],dist[100010]; map< pair<int,int> ,int> Map; bool mark[100010]; void path(int u){ if(parent[u]==u){ cout<<edges[u].first<<" "<<edges[u].second; return; } path(parent[u]); cout<<" "<<edges[u].second; } int main(){ int ant,curr,root,n; cin>>n; for(int i=0;i<n;i++){ cin>>curr; if(i>0){ edges[i].first=ant; edges[i].second=curr; adj[ant].push_back(curr); Map[make_pair(ant,curr)]=i; } if(i==0) root=curr; ant=curr; } if(root==curr){ cout<<root<<endl; return 0; } queue<int> q; for(int i=1;i<n;i++){ parent[i]=i; dist[i]=infInt; if(edges[i].first==root){ q.push(i); dist[i]=0; } if(edges[i].second==curr) mark[i]=true; }
while(!q.empty()){ int u=q.front(); q.pop(); int x=edges[u].first; int y=edges[u].second; for(auto z: adj[y]){ int v=Map[make_pair(y,z)]; if(v>u and dist[v]>dist[u]+1){ dist[v]=dist[u]+1; parent[v]=u; q.push(v); } } } int best=infInt,bestInd=-1; for(int i=1;i<n;i++){ if(dist[i]<best and mark[i]){ bestInd=i; best=dist[i]; } } path(bestInd); cout<<endl; return 0; } Or this, aldo wa 15 What´s the problem?? #include <bits/stdc++.h> using namespace std; const int infInt = 1e9; vector<int>adj[100010]; pair<int,int> edges[100010]; int final; map< pair<int,int> ,int> Map; bool mark[100010]; bool vis[100010]; int dp[100010]; int f(int u){ if(edges[u].second==final)return 0; if(vis[u])return dp[u]; vis[u]=true; int x=edges[u].first; int y=edges[u].second; int ans=infInt; for(auto z:adj[y]){ int v=Map[make_pair(y,z)]; if(v>u) ans=min(ans,1+f(v)); } return dp[u]=ans; } void rec(int u){ if(edges[u].second==final){ cout<<" "<<final<<endl; return; } int x=edges[u].first; int y=edges[u].second; for(auto z:adj[y]){ int v=Map[make_pair(y,z)]; if(v>u and dp[u]==1+f(v)){ cout<<" "<<y; rec(v); break; } } } int main(){ int ant,curr,root,n; cin>>n; for(int i=0;i<n;i++){ cin>>curr; if(i>0){ edges[i].first=ant; edges[i].second=curr; adj[ant].push_back(curr); Map[make_pair(ant,curr)]=i; } if(i==0) root=curr; ant=curr; if(i==n-1) final=curr; } if(root==curr){ cout<<root<<endl; return 0; } int best=infInt,bestInd=-1; for(int i=1;i<n;i++){ if(edges[i].first==root){ int ans=f(i); if(ans < best){ best=ans; bestInd=i; } } } cout<<edges[bestInd].first; rec(bestInd); } Please help #include <bits/stdc++.h> using namespace std; const int infInt = 1<<30; vector<int>adj[100010]; pair<int,int> edges[100010]; int parent[100010],dist[100010]; map< pair<int,int> ,int> Map; bool mark[100010]; void path(int u){ if(parent[u]==u){ cout<<edges[u].first<<" "<<edges[u].second; return; } path(parent[u]); cout<<" "<<edges[u].second; } int main(){ int ant,curr,root,n; cin>>n; for(int i=0;i<n;i++){ cin>>curr; if(i>0){ edges[i].first=ant; edges[i].second=curr; adj[ant].push_back(curr); Map[make_pair(ant,curr)]=i; } if(i==0) root=curr; ant=curr; } if(root==curr){ cout<<root<<endl; return 0; } queue<int> q; for(int i=1;i<n;i++){ parent[i]=i; dist[i]=infInt; if(edges[i].first==root){ q.push(i); dist[i]=0; } if(edges[i].second==curr) mark[i]=true; }
while(!q.empty()){ int u=q.front(); q.pop(); int x=edges[u].first; int y=edges[u].second; for(auto z: adj[y]){ int v=Map[make_pair(y,z)]; if(v>u and dist[v]>dist[u]+1){ dist[v]=dist[u]+1; parent[v]=u; q.push(v); } } } int best=infInt,bestInd=-1; for(int i=1;i<n;i++){ if(dist[i]<best and mark[i]){ bestInd=i; best=dist[i]; } } path(bestInd); cout<<endl; return 0; } |
Congratulations | Mahilewets Nikita [BSUIR] | | 30 авг 2017 02:02 | 2 |
|
How to solve this problem?I used Djkstra,but I've got TLE. | November Rain | 1325. Грязь | 16 авг 2017 01:32 | 8 |
Lee algorithm. Runs in O(N * M). If you don't know it, here is a short description: you start from starting position (sl, sc) and now you expand this node; in a queue you put all its neighbours. You do this only if you optimize by going to that neighbour, i.e. the current cost is shorter than the previous one. let a[i][j] be a matrix with two fields: boots and length. a[i][j] means: minimum number of boots and minimum length to reach (i, j) from start position. You expand from (x, y) to a neighbour (c, d) when: a[x][y].boots + 1 (if you change boots, 0 else) < a[c][d].boots or a[x][y].boots + 1 = a[c][d].boots and a[x][y].length + 1 < a[c][d].length. Obvious, you take the valid neighbours (not 0s or outside ones) hope it's clear... Can someone explain where is the problem in this solution? I just used the algorithm as you described. But it got tle. Anyway thank you very much. Now I've got it,using heap will help me. Edited by author 19.04.2004 20:55 I wrote the solution with Lee's algorithm, as it was discribed above by Gheorghe Stefan, and got TL on test 16. I doubt it works in O(MN). I test the solution at my local computer - it gaves the correct answers (obviously), but works about 10 times slower, then my solution with Dijkstra! I BFS on number of boots and Dijkstra on walk-length inside odd/even slices. Dijkstra is linear-time here because of same-length edges (front line is kept as bidirectional list in non-descending order of walk-length, insertion position goes only forwards). AC in 0.062 sec :) Edited by author 21.08.2008 21:13 It could be proved that in Dijkstra's algorithm the choice K = E /V is assimptotically optimal. So, applying to our problem, E / V equals to 8. |
To Admins | yifei | 1358. Провода | 15 авг 2017 23:41 | 3 |
Can the coordinates be negative integers? yes, coordinates may be negative and this problem is very very easy :) This makes the problem much easier. Can anyone share the solution without this condition? |
Tests for WA7 | Filip Franik | 1878. Кубик Рубинчика | 14 авг 2017 19:48 | 1 |
3 1 2 4 1 3 4 2 4 2 1 3 2 4 3 1 (4) 4 1 2 1 1 4 1 2 4 3 2 3 3 4 3 2 (2) |