| Show all threads Hide all threads Show all messages Hide all messages |
| WA at test#2, please help ! | Najmaddin Akhundov | 1048. Superlong Sums | 18 Jul 2019 09:12 | 5 |
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int a; int b; long double c=0; for (unsigned int i = 0; i < n; i++) { cin >> a; cin >> b; if (i != 0 ) { c = c * 10 + a + b; } else c = a + b;
}
cout <<c<< endl; } 3 1 1 9 0 9 1 try this this test helped me My code's producing 300. It's right, isn't it? What is double mantissa size? About 17 decimal digits? What is required number size? About 1,000,000 digits? So, how your solution is supposed to work? //wa on test 2 .. whats the problem with my code #include<bits/stdc++.h> using namespace std; int main() { long n,i,j=0; cin>>n; int a[2000003],b=0; string s; n*=2; for(i=0;i<n;i++){ cin>>a[i]; } for(i=n-1;i>=0;i=i-2){ b=(b+a[i]+a[i-1]); s[j]=(b%10)+48; b=b/10; j++; } for(i=j-1;i>=0;i--){ cout<<s[i]; } } |
| Why find two mins is wrong algoritm? | AlexRad | 1964. Chinese Dialects | 18 Jul 2019 07:19 | 3 |
What is correct algorithm? My program that find 2 mins and print Math.Max(min1 + min2 - n, 0) don't pass test 13. Consider test 3 3 2 2 2 Your solution says that there is a person who knows three different dialects. But we can construct an example where it is not true: 1) first person knows dialects number 1 and 2 2) second knows 1 and 3 3) third knows 2 and 3 Do u give me ur wrong code? |
| What's the meaning of the problem?? | zhao kai | 1877. Bicycle Codes | 17 Jul 2019 00:24 | 4 |
How did the thief steal the bicycle ?I'm not pretty sure. Is there some one telling me ? The thief steals the bicycle if he opens the lock, that is, if the code he tries is the same as the code for the lock. Test 1: Den's keys: 0001 0000 1st night 2nd night 3rd night 4th night ... ... ... All nights bike's key 0001 0000 0001 0000 - bad man 0000 0001 0003 0004 - result no no no no no Test 2: Den's keys: 0002 0001 1st night 2nd night 3rd night 4th night ... ... ... All nights bike's key 0002 0001 0002 0001 - bad man 0000 0001 0003 0004 - result no yes no no yes In the first test all nights result is "no". That why in the first test result is no. Thanks a lot for the explanation. |
| Java 8: How to use both input and output? | Ionkin M [Samara SAU #617] | 1601. AntiCAPS | 15 Jul 2019 19:38 | 2 |
Sorry for my bad English. I use int ch; while ((ch = System.in.read()) != -1) { // my solution System.out.print(<some char>); } System.out.println(); But I get WA #1 with or without last code line. I also used System.out.flush (without last line), but it do not help me. Use Scanner from utils,that's better and esier , than use System.in.read() |
| wa on test 55 | abid1729 | 2111. Plato | 15 Jul 2019 00:46 | 2 |
Edited by author 24.06.2019 13:55 use 'long' instead of 'int' as accumulator |
| No subject | ∭Andreyka∭ | 2025. Line Fighting | 14 Jul 2019 12:16 | 1 |
hEdited by author 19.07.2019 12:15 Edited by author 19.07.2019 12:16 |
| WA test №6 Python | Alex | 1263. Elections | 14 Jul 2019 02:59 | 2 |
import math nm = input().split() n = int(nm[0]) m = int(nm[1]) res = set() result = [] for i in range(m): x = int(input()) if x not in res: res.add(x) result.append(x) answer = [] for i in res: answer.append(result.count(i)) while n - len(answer) > 0: answer.append(0) for i in answer: v = str(round(i*100/m, 2)) if v[-2] + v[-1] == '.0': print(str(round(i*100/m, 2)) + '0%') else: print(str(round(i*100/m, 2)) + '%')
Edited by author 24.02.2019 01:39 Edited by author 09.03.2019 03:19 n, m = [int(x) for x in input().split()] x = 0 k = [0]*(n) for i in range(m): x = int(input()) k[x-1] = k[x-1]+1 for u in range(n): print( "%.2f" % (k[u]*100/ m), "%", sep="" ) |
| WA #9 / WA #11 | 👨🏻💻 Spatarel Dan Constantin | 1188. Library | 12 Jul 2019 21:26 | 2 |
input: 10 5 4 4 2 1 1 4 0 4 3 0 10 4 10 output: 1 4 14 6 1 5 4 1 4 3 0 3 3 0 13 4 7 4 7 1 0 1 5 3 1 0 1 output: 1 3 |
| Tle in 6? Look at source code. | Cebiyev_Ferhad_Qafqaz U. | 1654. Cipher Message | 12 Jul 2019 20:08 | 4 |
#include <iostream> #include <cstdlib> #include <deque> using namespace std; int main() { int h; char s[200001]; scanf("%s", &s); int n=strlen(s); deque<char> v (s, s + n );
if(v.size()==2 && v[0]==v[1] ) return 0; b: h=2; for(int i=0; i<v.size()-1 ;i++) if(v[i] == v[i+1]) { v.erase(v.begin() + i); v.erase(v.begin() + i); h=1; } if(h==1) goto b;
for(int i=0; i<v.size(); i++) cout << v[i];
return 0; } Hello, If you are still working on this, let you know that it can't be solved with erase. I implemented a similar algorithm in Java which goes through the string and deletes the successful characters and it also got TLE on test 6.The easiest way is removing the successful characters as you read them. nc->new character from the input. if(i!=-1&&c[i]==nc){//new char is equal to the char at the end of the string, remove it i--; }else{ //add the new char to the string i++; c[i]=nc; } Hope this helps You got TLE because deque has poor deletion performance on positions other than the front and back. |
| NP-hard?! | Erop [USU] | 1208. Legendary Teams Contest | 12 Jul 2019 15:09 | 4 |
very similar to the NP-complete problem 3-dimensional matching (3-сочетания) Yes, this problem is NP-hard. i have a not brute force solution. The conditions of the problem impose restrictions on the graph But your algorithm is wrong :) We added more tests and now you have WA. Thank you! |
| Nice sequence | candide | 1079. Maximum | 12 Jul 2019 04:18 | 3 |
You can solve the question very fast with appropriate precomputed values. The sequence is known as the Stern-Brocot sequence, I was not aware of it before! |
| No subject | Vladimir Putin | 2018. The Debut Album | 12 Jul 2019 04:18 | 1 |
Edited by author 12.07.2019 04:29 |
| can u help me? here is my code | beautiful | 1607. Taxi | 12 Jul 2019 02:19 | 7 |
#include<iostream> using namespace std; int main(){ int petr,a,taxi,b; int temp; while(cin>>petr>>a>>taxi>>b){ if(petr>=taxi)cout<<petr<<endl;
else{ temp=taxi-petr; if(a<=b){ while(temp>b){ petr+=a,taxi-=b; temp=taxi-petr; } cout<<petr+a<<endl; } else{ while(temp>a){ petr+=a,taxi-=b; temp=taxi-petr; } cout<<taxi<<endl; } } } } i pass all the test that the discuss give but i still get wa at #4 could u give me some new test? if(a<=b) ---> if(a<b) but i still get wa at #13 for exanmple try test 1000 2 2000 3 the right answer is 1400 but your prog output 1402 or try this 1 2 12 3 right is 6 but yours is 7 Edited by author 20.03.2008 17:57 thanks for 2nd test, it really helpfull) // solve #include <iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; while(a< c) { if(a+b > c) { a=c; break; } a= a+b; if(c <= a) { break; } c = c-d; }
cout<<a<<endl; return 0; } |
| TLE #2 & WA #2 | 👨🏻💻 Spatarel Dan Constantin | 2059. Not common palindromes | 11 Jul 2019 03:01 | 1 |
First and foremost, is seems to me that there are only two test cases: (1) the sample case (2) an 8MB test case For WA this test helped me: input: 2 bbaadbdcc aadbdbcbadb aadbdbcbadb bbaadbdcc output: Case #1: 3 2 5 Case #2: 5 2 3 For TLE: parse the input I optimized all sorts of things but eventually I ran out of ideas. Then I remembered someone else was mentioning he submitted the same code again and passed got rid of TLE. Also, from my own experience, I noticed there was a sort of "randomness" in the time execution from one submission to another. (I was able to detect it by killing my program after processing 6MB of the input file.) At this point I was seriously considering speeding up the input reading part of my program using custom code instead of stdin.h. I got 760ms for processing 6MB of the input and I said to myself I'm really close: my code should run in 1.040s. And so I decided to parse the input: I got AC in 560ms! A 480ms boost of speed! So... long story short: parse the input! |
| Some test, which may help you | DixonD (Lviv NU) | 1203. Scientific Conference | 10 Jul 2019 16:22 | 2 |
5 1 9 14 15 1 11 12 13 10 15 Right answer is 3, but some algorithmes may give answer 2 for this test. P.S. I had this mistake:( P.P.S. Sorry, for my poor English... Thank you! This test helped me to fix WA6 Edited by author 10.07.2019 16:23 |
| WA14 | Skiminok | 1400. Cellular Characters | 8 Jul 2019 19:37 | 2 |
WA14 Skiminok 17 Mar 2008 02:01 WA14(( No ideas... I tried any tests my brain could imagine. Can anybody help, plz? Hello, I can help you if want. If you give me your email I write you what I made to got AC from WA14.Sorry for bag english Edited by author 08.07.2019 19:37 |
| Some special test pls | Hemaeg | 1658. Sum of Digits | 8 Jul 2019 14:23 | 6 |
I have try many of my tests, but I don't know what is wrong in my code. What is test #2, please? Try this one: INPUT 10 1 1 10 100 200 400 900 8100 45 285 456 2119 456 2120 456 3456 456 4080 456 4081 OUTPUT 1 No solution 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 14667777 No solution 1334444444444444444444444444444444444445555555555555555555555555555555555555555555555555555555555555 2677777777777777777777777788888888888888888888888888888888888 888999999999999999999999999999999999999999999999999 No solution Thank you for your test data! WA2 Ilya 8 Jul 2019 14:23 Thks you bruh. ths s1 and s2 hack me ->(456 2120) Me too. I try the Special test but it's wrong #2 test still. The #2 test is 100 100 ,or others which the length is 100. |
| Runtime error , Case 8 | Sarvagya Agarwal | 1012. K-based Numbers. Version 2 | 6 Jul 2019 10:17 | 3 |
Why does this give runtime error #8 . n = int(raw_input()) k = int(raw_input()) dp = [[-1 for x in xrange(15)]for y in xrange(1910)] def solve(index,prev) : if(index > n ) : return 1 if(dp[index][prev] != -1) : return dp[index][prev] res = 0 start = 0 if(index == 1) : start = 1 for i in xrange(start,k) : if(prev == 0 and i == 0) : continue res = res + solve(index+1,i) dp[index][prev] = res ; return res print solve(1,0) Same for me, solution is python3. You have to check for recursion depth exceeded. Do it iterative. |
| тест №6 в чем проблема? pascal | Alectros | 2023. Donald is a postman | 5 Jul 2019 20:53 | 4 |
var str: string; i,kol,n,pol: integer; begin readln(n); pol:=1; kol:=0; for i:=1 to n do begin readln(str); if (str='Alice')or(str='Ariel')or(str='Aurora')or(str='Phil')or(str='Peter')or(str='Olaf')or(str='Phoebus')or(str='Ralph')or(str='Robin') then begin kol:=kol+abs(pol-1);pol:=1; end else if (str='Bembe')or(str='Belle')or(str='Bolt')or(str='Mulan')or(str='Mowgli')or(str='Mickey')or(str='Silver')or(str='Simba')or(str='Stitch') then begin kol:=kol+abs(pol-2);pol:=2; end else if (str='Dumbo')or(str='Genie')or(str='Jiminy')or(str='Kuzko')or(str='Kida')or(str='Kenai')or(str='Tarzan')or(str='Tiana')or(str='Winnie') then begin kol:=kol+abs(pol-3);pol:=3; end; end; write(kol); end. Edited by author 17.11.2016 23:36 Edited by author 17.11.2016 23:36 For me it was a type mistake in "Mickey" а все моя ошибка написал "Bembe" вместо "Bambi" |
| WA #6 | 👨🏻💻 Spatarel Dan Constantin | 1188. Library | 4 Jul 2019 21:42 | 1 |
WA #6 👨🏻💻 Spatarel Dan Constantin 4 Jul 2019 21:42 input: 6 5 6 4 2 1 0 6 1 5 3 0 6 0 6 output: 2 6 |