Show all threads Hide all threads Show all messages Hide all messages |
TIMUS ID / Handle | Ashfak Hossain Evan | | 14 Dec 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. Two Teams | 13 Dec 2022 12:29 | 2 |
Could you please show your solution or hint? |
WA5 . Where is mistake? | Lev_Kireenko 🐬 | 2015. Zhenya moves from the dormitory | 13 Dec 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. Intervals of Monotonicity | 13 Dec 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. Scrum | 12 Dec 2022 14:31 | 1 |
Hint Hristo Nikolaev (B&W) 12 Dec 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. Caravans | 12 Dec 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. Gaby Ivanushka | 10 Dec 2022 19:20 | 1 |
Hint GeekCmore 10 Dec 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. The Good, the Bad and the Ugly | 10 Dec 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. About Grisha N. | 9 Dec 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. Fibonacci Sequence | 9 Dec 2022 03:00 | 1 |
Consider the case in which n < i, j That helped me to get AC |
About output | Aliaksei | 1944. Record of the Attack at the Orbit | 8 Dec 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. |
Very Easy Problem used Sieve algorithm and got accepted | Anwar | 1355. Bald Spot Revisited | 8 Dec 2022 02:27 | 3 |
Prime Divisor of b - Prime Divisor of a can be even simpler and faster - Prime Divisors of (b / a) |
Be carefull !!! WA2 is simple | [RSU_Tash]Nodirbek_Kuklamov | 1680. The First Nonqualifying | 7 Dec 2022 21:12 | 4 |
You must find the first team that may go final if q wil be q+1. You mustn't output the team after q th finalist. Example: 2012 6 3 SPBU ITMO # 1 (finalist) URAL SU # 1 (finalist) SPBU ITMO # 2 SARATOV SU # 3 (finalist) URAL SU # 2 (not finalist !!!) SPBU SU # 1 (answer) Edited by author 03.12.2011 13:18 Edited by author 26.11.2019 02:40 And one more thing to look for - after the number is removed, make sure any white spaces are trimmed at the end. i.e. "SPBU SU " should be "SPBU SU" |
Test 3 | Конобейцев Иван Олегович | 1962. In Chinese Restaurant | 7 Dec 2022 16:49 | 1 |
Test 3 Конобейцев Иван Олегович 7 Dec 2022 16:49 |
Numbers input | Амаяк | 1032. Find a Multiple | 6 Dec 2022 16:39 | 2 |
How do I get an unlimited length array from the console so that the test starts? What is the end character of the input? When you use scanf(), generall you can check the return value of scanf(). If the return value is equal to -1, it means that it gets the end of input. Besides, you when you use cin, you can just judge if the input is end by the return value of cin is 0 or not. If it is 0, it means the end. eg: int main(){ int n; while(scanf("%d", &n) != -1){ .... } } and int main(){ int n; while(cin >> n){ .... } } |
Тест | andy | 1864. Get-Together at Den's | 5 Dec 2022 21:20 | 11 |
Тест andy 15 Oct 2011 17:23 сколько у кого на тесте 6 60 30 20 10 0 0 ?? Re: Тест Aleksandr Kim 15 Oct 2011 17:25 Re: Тест Vitaliy Karelin 15 Oct 2011 17:29 Aleksandr Kim: You got AC? Edited by author 15.10.2011 17:30 Make sure you round the numbers down. I got wa 4 too. Re: Тест Vitaliy Karelin 15 Oct 2011 17:25 73 21 4 0 0 0 But i have WA#9 Re: Тест Soporboy Botirov [TUIT Urgench] 15 Oct 2011 17:28 73 21 4 0 0 0 but i have wa#9 My AC program gives 73 21 4 0 0 0 сколько у кого на тесте 6 60 30 20 10 0 0 ?? My code give : 50 25 16 8 0 0 Re: Тест Hristo Nikolaev (B&W) 5 Dec 2022 21:20 The right answer for 6 60 30 20 10 0 0 is 73 21 4 0 0 0 I can confirm it with a code that got AC. If you get that result, and still get WA9 - add 0.00001 to the result before you cast it to int. |
What is WA#9 | Soporboy Botirov [TUIT Urgench] | 1864. Get-Together at Den's | 5 Dec 2022 21:16 | 22 |
What is WA#9 Soporboy Botirov [TUIT Urgench] 15 Oct 2011 14:54 Any one yes test? how about this one sample 5 5 3 3 3 3 ? this ans right 76 5 5 5 5? Edited by author 15.10.2011 14:59 I have 76 5 5 5 5 too, but WA#9 also too my solution also WA 9 test 76 5 5 5 5 too Edited by author 15.10.2011 15:59 Edited by author 15.10.2011 15:59 Mine gives 76 6 6 6 6 but WA 4 :) Edited by author 15.10.2011 16:19 my solution also WA 9 test 76 5 5 5 5 too You've got the AC? as may be the answer? if all friends and Dan drank equally, then each are drank at 2.8 liters => each of them has bought more than drinking sorry for bad english :) I think it should be 100 0 0 0 0. Because everyone drank 3,8l and 4 of them bought 3l and Dan doesn't have to pay them. Edited by author 15.10.2011 17:10 Why? They brought 5+3+3+3+3 = 17, so everyone drank 17/6 = 2,8(3). George_Aloyan[PTSObninsk] is rigth This wtf situation from precision. Эта всё из-за точности. For example: Например: 4.99999999999999999999999999 But in real this is 5. When this are arounded in floor we get 4. Но на самом деле это число 5. А при округлении вниз получаем 4. So! Итак! This get WA9 floor(100.0*(a[i]-half)/mt); But this get AC floor(100.0*(a[i]-half)/mt+0.0001); P.S.: get 10 times WA9 =) Edited by author 15.10.2011 18:19 Edited by author 15.10.2011 18:19 Edited by author 15.10.2011 18:20 This wtf situation from precision. But this get AC floor(100.0*(a[i]-half)/mt+0.0001); Thank you very much. AC Thanks a lot, but really a strange situation)I understand the problem now, but... *Started reversing my solution* :) +0.0001 gave me WA#11 but +0.00001 gives AC ;) Friends! Problem can be solved easy in int type only without any 0.0001 and so on. Multiply all by common denumenators and have joy of AC. min multiplied coefficient is 5 - to get the AC=)(on Java) on c++ I used coefficient - 1000 Edited by author 15.10.2011 22:00 Thanks, I had a WA#5, added +0.0001 and got AC Hi, everyone! I had WA#9 too, but I wrote 'long double' instead of 'double' and got AC. It means it was precision's trouble. Edited by author 23.11.2017 18:25 I had the same problem. changing double to long double didn`t help, but adding 0.0001 to the result before casting it to int got my code AC. Apparently it`s an epsilon problem. My AC program answers to the test:5 5 3 3 3 3 76 5 5 5 5 too. |
Admins, something is wrong with these tests. | Hristo Nikolaev (B&W) | 1984. Dummy Guy | 5 Dec 2022 14:03 | 1 |
|
just print random numbers to get ac | 👑TIMOFEY👑 | 1070. Local Time | 4 Dec 2022 15:59 | 1 |
|
Some tests | D4nick | 1846. GCD 2010 | 2 Dec 2022 10:00 | 2 |
10 + 24 + 27 + 9 + 24 + 12 - 24 - 24 - 12 - 27 - 9 24 3 3 3 3 3 3 9 9 1 5 + 8 + 6 + 8 - 8 - 8 8 2 2 2 6 9 + 10 + 10 + 10 - 10 - 10 + 5 - 10 - 5 + 123 10 10 10 10 10 5 5 1 123 The following test helped me to catch out-of-index run time exception in my solution: IN: 18 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 32 - 32 OUT: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32 1 |