Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Admins, make it 3 ≤ N ≤ 333 | Hristo Nikolaev (B&W) | 1033. Лабиринт | 24 дек 2022 16:30 | 1 |
Or at least add another version of the problem with huge labyrinths. I had a lot of fun with this problem, and was surprised that a solution which is far from perfect can work instantly with input 200x200. |
if WA4 try this | skyhoop | 1033. Лабиринт | 24 дек 2022 16:19 | 5 |
Thanks!This really helps. Thx a lot! But I thought the end of the labyrinth must be reachable from the beginning... Thank you! I also gathered the impression that 1,1 is the entrance, and n,n is the exit ... Without this misunderstanding, I would have had AC from the very first attempt. Cheers! |
about TLE (spoilers) | Gerasimov Alexander Dmitrievich | 1915. Руины титанов: воссоздание былого | 23 дек 2022 01:32 | 2 |
In C#, I was getting TLE using LinkedList, so I rewrote everything using an array of 2*10^6 elements. It passed in 1.7s (thank god), but that's still very slow. How do people get times like 0.2s? It can be much faster if implemented in C/C++. (Edit: I just saw that you have submitted a faster solution in C++) A simple trick I used is to ignore 0 (copy the entire stack) if its elements are > 10^6 Edited by author 23.12.2022 01:43 |
Very very bad title | ucs6 | 1280. Topological Sorting | 22 дек 2022 19:15 | 3 |
Don't be trapped by the title of this problem...it would just make it more complicated I see no problem in the title. It's a very simple straight forward TOP_SORT problem. And I have seen some critical cases in other threads which cases would appear 'critical' if and only if any process other than simple top_sort is approached. I`d say don`t be trapped by the category of the problem. It says Graph Theory, but can be easily solved with other data structures. |
Accepted map<int, set<int> > + lower_bound 0.499 | nadinne | 1613. Для любителей статистики | 22 дек 2022 18:52 | 5 |
Edited by author 06.02.2016 13:30 Edited by author 06.02.2016 13:38 My result is 0.1 sec, 700 Kb memory usage. I used VS 2013 (probably its IO works quicker then gcc), C-style (printf/scanf) IO, sorted vector of pairs (count_of_passengers, city_number). Have a similar solution for Java: HashMap<Integer, TreeSet<Integer>> and floor/ceiling functions. I've got execution time: 0.998 it's kinda funny )) Edited by author 28.03.2019 12:57 I used the same approach - works much faster 0.218 make sure you are not making unintended copies of the set and use a reference - std::set<int>& current_set = m[x]; instead of std::set<int> current_set = m[x]; |
i got AC in C.. | Suparna | 1068. Сумма | 18 дек 2022 20:07 | 3 |
int num,n,i,sum=0; // read n;
//case 1 if(n>0){ for(i=1;i<=n;i++){ sum=sum+i; } printf("%d",sum); } //case 2 if(n<0){ for(i=(-1);i>=n;i--){ sum=sum+i; } sum=sum+1; printf("%d",sum); } //case 3 else if(n==0){ printf("1"); } } when n<0,then sum=sum+1; why you using sum=sum+1; #include<stdio.h> int main() { int num,n,i,sum=0; scanf("%d", &n); if(n>0){ for(i=1;i<=n;i++){ sum=sum+i; } printf("%d",sum); } if(n<0){ for(i=n;i<=1;i++){ sum=sum+i; }
printf("%d",sum); } else if(n==0){ printf("1"); } } |
Admins, please fix the tests. | Hristo Nikolaev (B&W) | 1517. Свобода выбора | 18 дек 2022 00:57 | 1 |
Using the same code, and only switching the order of the 2 input strings ... scanf("%s", strr); scanf("%s", strl); leads to WA5 switching the order (shouldn`t make any difference) scanf("%s", strl); scanf("%s", strr); and I get WA6 |
One more WA2, and none of the tests help | Hristo Nikolaev (B&W) | 1038. Проверка орфографии | 17 дек 2022 02:18 | 2 |
I tried everything suggested in the discussion. Each test works, but when I submit, I get WA2. Can you please add more tests? Strange ... and now I got AC without any change to the logic. Just made each char taken from getchar() processed immediately instead of filling an array and then processing the array. Both versions work equally well on my computer. I use VS 2022. And one more thing - absolutely the same way of reading the input and filling the array I initially had a WA2 with, worked perfectly for problem 1601. AntiCAPS. (Actually that's where I copied the functionality from before I start). I guess Admins should take a look at this. Edited by author 17.12.2022 02:22 |
To those who get WA#7 | vicproon | 1205. На метро или пешком? | 17 дек 2022 00:16 | 8 |
Looks like stations can overlap (have same coordinates) while not being connected with underground! What does this actually mean??? If coordinates are the same then travelling time is still 0. is not it? Even I found that footseed is 0.5 in test 7. But what then? It doesn't change my solution and i can not understand if it actually does... :( You are right, ori and dst stations can overlap connected stations. I think, not only stations can overlap but also original and destination points. Two below tests helped me to understand my mistake when I've received Runtime Error 7 and Wrong Answer 7: 1 100 4 1 1 2 2 3 3 2 2 2 1 3 4 4 2 0 0 1 1 3 3 answer: 0.0282843 4 1 2 4 3 1 100 3 1 1 2 2 3 3 2 1 3 2 1 3 0 0 1 1 1 1 answer: 0.000000 0 Edited by author 26.10.2018 16:55 Edited by author 26.10.2018 16:56 Got correct answers for both tests above (and for all others in other topics). Still WA7. To authors of the problem - burn in hell. try this one 1 100 5 0 0 1 0 9 0 9 9 10 10 1 2 1 3 2 4 0 0 10 10 the result should be 2.6346295 4 4 2 1 3 10 0 test is not correst, no destination point Edited by author 17.12.2022 00:16 Edited by author 17.12.2022 00:16 Edited by author 17.12.2022 00:17 |
TIMUS ID / Handle | Ashfak Hossain Evan | | 14 дек 2022 22:57 | 1 |
What is my timus handle ? in a place I give my username and they decline that and say that timus handle should be a number. What is my number? how can I find the ID? Edited by author 14.12.2022 22:58 |
bfs is not needed | vegetable | 1106. Две команды | 13 дек 2022 12:29 | 2 |
Could you please show your solution or hint? |
WA5 . Where is mistake? | Lev_Kireenko 🐬 | 2015. Женя переезжает из общежития | 13 дек 2022 02:57 | 2 |
cost, fun1, fun2 = map(int,input().split()) fri, flat2 = [], [] for i in range(int(input())): fri.append(list(map(int,input().split())))
temp1, temp2 = [-1,-1], [-1, -1, -1] #веселье, квартрира, сосед for i in range(int(input())) : a, b, c = map(int,input().split()) if a == 2 : flat2.append([b,c,i+1]) # стоимость, веселье, номер if fun1 + c > temp1[0] and cost >= b : temp1 = [fun1+c, i+1]
for i in range(len(flat2)) : b, c, k = flat2[i][0], flat2[i][1], flat2[i][2] for j in range(len(fri)) : if fri[j][0] >= b/2 and cost >= b/2 and fun2+fri[j][1]+c > temp2[0] : temp2 = [fun2+fri[j][1]+c, j+1, k] if temp1[0] == -1 and temp2[0] == -1 : print('Forget about apartments. Live in the dormitory.') elif temp1[0] > temp2[0] : print('You should rent the apartment #'+str(temp1[1])+ ' alone.') else : print('You should rent the apartment #'+str(temp2[2])+' with the friend #'+str(temp2[1])+'.') Edited by author 16.09.2016 21:53 fun2 is when you live alone, so you can't add fun2 when living with a friend |
to admins: | esbybb | 1346. Интервалы монотонности | 13 дек 2022 01:33 | 2 |
hi, this is O(1) complexity problem, you might want to decrease the Difficulty i guess to others: if you have found an extremum skip next point That's what I thought too ... the difficulty could be decreased by half at least. Maybe even more. |
Hint | Hristo Nikolaev (B&W) | 2095. Скрам | 12 дек 2022 14:31 | 1 |
Hint Hristo Nikolaev (B&W) 12 дек 2022 14:31 AC in 0.015 is possible without any precalculations. Make a function that returns the quiet days until day N The answer is F(r) - F(l). The is a special case if l has to be counted - that happens if F(l) != F(l-1) (in other words F(l) is part of the sequence we are looking for) If l=1, just return F(r) The implementation of F(n) can be simple if you find the right approach. It's simple to count how many days remain in the sequence after eliminating each 2nd, then each 3rd, and so on. |
WA 32 ...why this method is wrong | Sagar Goyal | 2034. Корованы | 12 дек 2022 03:21 | 3 |
Out of all shortest path I am finding min of maximum distance I have to travel for every level. #include<bits/stdc++.h> using namespace std; void bfs(int u,vector<int> &d,const vector<vector<int>> adj){ d[u] = 0; queue<int> q; q.push(u); while(!q.empty()){ int u = q.front(); q.pop(); for(auto v:adj[u]){ if(d[v]>d[u]+1){ d[v]=d[u]+1; q.push(v); } } } } int main(){ int n,m; cin>>n>>m; vector<vector<int>> adj(n); for(int i=0;i<m;i++){ int u,v; cin>>u>>v; adj[u-1].push_back(v-1); adj[v-1].push_back(u-1); } vector<int> ds(n,1e9),df(n,1e9),dr(n,1e9); int s,f,r; cin>>s>>f>>r; s--,f--,r--; bfs(s,ds,adj); bfs(f,df,adj); bfs(r,dr,adj); vector<vector<int>> l(ds[f]+1); for(int i=0;i<n;i++){ if(ds[i]+df[i]==ds[f]){ l[ds[i]].push_back(i); } } int ans = INT_MAX; for(int i=0;i<=ds[f];i++){ int a = INT_MIN; for(auto x: l[i]){ a = max(a,dr[x]); } ans = min(a,ans); } cout<<ans; return 0; } This is wrong because you're assuming that the answer is the minimum distance to the robbers in its unique optimal path, which is not always true. Edited by author 17.08.2022 04:41 Edited by author 17.08.2022 04:41 Consider this test: 9 12 1 2 1 3 2 4 2 5 3 6 3 7 4 6 4 9 5 6 6 8 7 8 7 9 1 9 6 Correct answer: 1 (shortest path is either 1-2-4-9 or 1-3-7-9, so robbers can move 6-4 or 6-3) |
Hint | GeekCmore | 1082. Иванушка-дурачок | 10 дек 2022 19:20 | 1 |
Hint GeekCmore 10 дек 2022 19:20 Just think of an increasing sequence. The program caculates n+1 times for an increasing sequence with n elements. And then divide it into two subsequences. One is the leftmost element, and anthoer is the left elements. It ends at the length of sequence is 2. Thus, the sum is (n+1) + n + (n-1) + ... + 3 = (n+4)(n-1)/2 = (n*n + 3*n - 4)/2. So output 1 to n is ok. |
My favorate answer to this question, but dunno y it is not fast enough. | some_programming_novice | 2138. Хороший, плохой, злой | 10 дек 2022 16:44 | 3 |
union message { char bytes[4]; unsigned value; void reverse() { swap(bytes[0], bytes[3]); swap(bytes[1], bytes[2]); } }; Wow! That's unexpected =) |
Why wrong answer?:((((( | Anasyasia | 2012. Про Гришу Н. | 9 дек 2022 21:10 | 2 |
#include <iostream> using namespace std; int main() { int a; cin>>a; if (a>=7) cout<<"Yes"; if (a<7) cout<<"No"; return 0; } |
If anyone gets WA19... | Hristo Nikolaev (B&W) | 1133. Последовательность Фибоначчи | 9 дек 2022 03:00 | 1 |
Consider the case in which n < i, j That helped me to get AC |
About output | Aliaksei | 1944. Досье орбитальной атаки | 8 дек 2022 16:08 | 4 |
Is the first test from conditions? If answer is "yes", then why the system say "WA1"? The program works correctly on my computer. Maybe, I misunderstood something important, and my output has wrong format? Help me, please. Edited by author 05.01.2013 15:42 Use "read" instead of "readln" I had a very similar problem - WA1 ... each test I could think of was working correctly. Finally I changed the new line from \r\n to \n - that fixed the problem. |