| Show all threads Hide all threads Show all messages Hide all messages |
| Wrong Answer Test Case #1 | skartik | 2018. The Debut Album | 17 Mar 2020 11:41 | 1 |
I don't know why my solution is failing on test case 1, I have tested against all available test cases with correct answer , but cannot pass test case 1, can anybody please tell what is test case 1. |
| Change judge id | gt123 | | 16 Mar 2020 21:20 | 1 |
Is it possible to change the judge id? Thanks |
| WA#1 | mushfiq | 1022. Genealogical Tree | 13 Mar 2020 13:08 | 3 |
WA#1 mushfiq 27 Oct 2014 16:07 It's the same as the given sample input. But what if i have the same answer that in sample, and get WA1? |
| why doesn't it work? java | Argin | 1644. A Whole Lot of Walnuts | 12 Mar 2020 20:58 | 3 |
import java.util.Scanner; public class javasucc { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int h = 2, s = 10; for(int i=0; i<n; i++) { int a = in.nextInt(); String b = in.next(); if(b=="hungry"){ if(a>h) {h = a;} } else if(b=="satisfied"){ if(a<s) {s = a;} } } if(h >= s) System.out.println("Inconsistent"); else System.out.println(s); } } and the problem is that program doesn't want to do if and i can't change s to a 1) I wasn't crying for help though but just was wondering why 2) Thanks for the link, the problem was actually in "==" |
| python ,why ?thanks!!!!!! | 水泥跑道 | 2023. Donald is a postman | 12 Mar 2020 17:49 | 1 |
n=int(input()) a=[] for i in range(n): s=input() if(s[0]=="A" or s[0]=="P" or s[0]=="O" or s[0]=="R"): a.append(0) elif(s[0]=="B" or s[0]=="M" or s[0]=="S"): a.append(1) else: a.append(2) t=0 for i in range(n): if(i+1<n): t=t+abs(a[i]-a[i+1]) print(t) |
| С++ code for brute force | D4nick | 1353. Milliard Vasya's Function | 11 Mar 2020 14:39 | 1 |
#include <stdio.h> #include <map> using namespace std; int main() { int ans, sum, ost, s; long int full, i; map <long int, int> sums; for (i = 1; i <= 1000000000; i++) { sum = 0; full = i; do { ost = full % 10; full /= 10; sum += ost; } while (full > 0); sums[i] = sum; } for (s = 1; s <= 81; s++) { ans = 0; for (i = 1; i <= 1000000000; i++) if (sums[i] == s) ans++; printf("{%ld}, ", ans); } } it will give you {10}, {...}, ... , {...}, vector that you can use for getting AC with O(1). Edited by author 11.03.2020 14:40 Edited by author 11.03.2020 14:44 |
| I assume that the Input text is not clear. | gtpt | 2066. Simple Expression | 10 Mar 2020 13:52 | 1 |
"The numbers are arranged in non-decreasing order (0 ≤ a ≤ b ≤ c ≤ 100)." I my opinion, reading this we assume that the input will already be sorted. |
| AC C++ | D4nick | 1644. A Whole Lot of Walnuts | 9 Mar 2020 01:40 | 1 |
AC C++ D4nick 9 Mar 2020 01:40 #include <iostream> #include <string> using namespace std; int main() { int hun = 2, sat = 10, n; cin >> n; string s; for (int i = 0, num; i < n; i++) { cin >> num >> s; if (s == "hungry") if (num > hun) hun = num; if (s == "satisfied") if (num < sat) sat = num; } if (hun >= sat) cout << "Inconsistent"; else cout << sat; } |
| Why RuntimeError on Test 6 Java | DWinter | 1263. Elections | 6 Mar 2020 12:36 | 3 |
import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Scanner; public class Task_1263 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String str = in.nextLine(); int candidateCount = Integer.valueOf(str.substring(0, 1)); int votersCount = Integer.valueOf(str.substring(2)); int[] votersForCandidates = new int[candidateCount]; double[] votersPercents = new double[candidateCount]; int voter; for (int i = 0; i < votersCount; i++) { voter = Integer.valueOf(in.nextLine()); votersForCandidates[voter - 1]++; } for (int i = 0; i < candidateCount; i++) { votersPercents[i] = new BigDecimal((double) 100 * votersForCandidates[i] / votersCount).setScale(2, RoundingMode.HALF_UP).doubleValue(); } for (int i = 0; i < candidateCount; i++) { out.printf("%.2f%%%n", votersPercents[i]); } out.flush(); } } Because of the Memory limit: which no more than 64 MB. votersPercents array is useless and should be removed. But the main error is you reading candidateCount in the wrong way. str.substring(0, 1) - how many digits can you read? What max candidateCount is? You use Scanner class. It has method nextInt() - you can just use it, you don't need to read strings and split them into numbers manually. |
| test case 80 | Gilles Deleuze | 1394. Ships. Version 2 | 6 Mar 2020 00:50 | 4 |
42 8 2 4 6 13 14 14 19 26 26 30 60 89 89 89 89 90 90 90 90 90 91 91 93 94 94 94 94 94 94 94 95 95 95 96 96 97 98 98 98 99 100 100 184 186 209 402 408 488 621 622 Are you sure? It get 0 nanoseconds for mine TLE67 version (for any random permutation of input). Edited by author 06.03.2020 00:50 Yes, I am sure. The tests are a bit peculiar for this problem. Some group of tests target specific solutions, so it's entirely possible your solution deals with some of the last tests easily (there should be 81 of them), but fails on earlier ones. Edited by author 05.03.2020 18:15 Thank you for the information. |
| Simple Solution in C++ | Sofiullah Iqbal Kiron | 2100. Wedding Dinner | 5 Mar 2020 16:59 | 1 |
$ Before going to the solution, make sure that you had tried enough, please. $ Code:- #include<bits/stdc++.h> #define START int main(){ #define END system("PAUSE");return 0;} using namespace std; START int n, guest=2; cin >> n; guest += n; while(n--) { string s; cin >> s; for(int i=0; i<s.size(); i++) { if(s[i]=='+') { guest++; } } } if(guest != 13) { cout << 100*guest << endl; } else { cout << 100*(guest+1) << endl; } END ///Thank You and Pray for me. Edited by author 05.03.2020 17:01 |
| what's answer if N==45 or N==5,6,7,8 | Badd | 1225. Flags | 5 Mar 2020 12:54 | 6 |
It's mean you are checking condition if variable N = 45 or N = 5,6,7,8 then go to do statement below your condition N = 45 -> answer = 2269806340 N = 5 -> answer = 10 N = 6 -> answer = 16 N = 7 -> answer = 26 N = 8 -> answer = 42 |
| Can it be solved on Python? | DmitriyBerg | 1439. Battle with You-Know-Who | 5 Mar 2020 00:40 | 1 |
I've used BST but still cannot optimize it... similar code on C is accepted with 0.171s 300kb but Python is processing the code way longer and TLE #14. And no solutions on python so far. Is there something that can be done? |
| If input is 1, 2, 5 | Sofiullah Iqbal Kiron | 2066. Simple Expression | 4 Mar 2020 22:43 | 1 |
The minimal output is: 1-2*5 = -9. Edited by author 04.03.2020 22:45 |
| Simple question | qwe (Dmitry) | 1635. Mnemonics and Palindromes | 4 Mar 2020 13:00 | 5 |
consider follow string: ABZZBBBZZA. 2 polindroms: ZZBBBZZ and ABA - correctly for this problem? i think answer is 3 polindroms: AB ZZBBBZZ A I thin its 4 palindromes A B ZZBBBZZ A Смотрю с любовью на свои более 10-летней давности попытки решать задачи. Спасибо, ACM.Timus! |
| Что не так ? What's wrong? | Maksim_Yudin | 1785. Lost in Localization | 3 Mar 2020 14:33 | 2 |
Python 3.6 a=int(input()) if a<=4 and a>=1: print("few") if a<=9 and A>=5: print("several") if a<=19 and a>=10: print("pack") if a<=49 and a>=20: print("lots") if a<=99 and a>=50: print("horde") if a<=249 and a>=100: print("throng") if a<=499 and a>=250: print("swarm") if a<=999 and a>=500: print("zounds") if a>=1000: print("legion") Попробуй другие отступы num_monst = int (input ("Write number of monster")) if 1 <= num_monst <= 4: print("few") elif 5 <= num_monst <= 9: print("several") elif 10 <= num_monst <= 19 : print("lots")
elif 20 <= num_monst <= 49 : print("horde") elif 50 <= num_monst <= 99 : print("throng") elif 100 <= num_monst <= 249 : print("swarm") elif 250 <= num_monst <= 999 : print("zounds") elif num_monst >= 1000 : print("legion") |
| Why fo N = 6 answer is 16 instead of 14? | IlyaGrebenyuk | 1225. Flags | 2 Mar 2020 14:14 | 2 |
Ya popitalsya perebrat' vse varianti dlya N = 6 i smog naschitat' tolko 14 vot oni: 1. WRWRWR 9. WRWRBW 2. RWRWRW 10. RWRWBR 3. WBRWRW 11. WBRBWR 4. RBWRWR 12. RBWBRW 5. WRBWRW 13. WRBWBR 6. RWBRWR 14. RWBRBW 7. WRWBRW 15. ?????? 8. RWRBWR 16. ?????? Kakie dva ya upustil? |
| why WA5?? | 123 | 1725. Sold Out! | 1 Mar 2020 23:45 | 6 |
#include<stdio.h> int n,k,answer; int main() { scanf("%d %d",&n,&k); int len = n/2; if(k==len) { printf("0"); return 0; } else if(k<len) { answer = len - k; } else { answer = k - len - 1; } printf("%d",answer); } I have the same problem: test no. 5, wrong answer. (Sorry, i don't know english well) Я запихнул свой алгоритм в циклы for, ввод всех возможных значений, вывод. Просмотрел всё вручную, нет ошибок! Carefully read the condition. Visitor chooses a side in such a way that the number of people over whose feet he will stumble will be minimal. It is not always the shortest path. Внимательнее читайте условие. Зритель выбирает сторону так, чтобы споткнуться о меньшее число людей. Это не всегда наикратчайший путь. Try test 50 50 answer 47 40-20 18 40 27 24 .... ???? PROFIT!!! Edited by author 08.06.2010 03:26 Edited by author 08.06.2010 03:27 k == n is the same situation as k == 1 |
| This test helped me with WA10 | Levon Oganesyan | 1116. Piecewise Constant Function | 1 Mar 2020 20:05 | 1 |
3 1 2 10 2 3 100 3 4 1000 1 1 2 10 Answer: 2 2 3 100 3 4 1000 |
| why i get wrong in test case 2? | Sakib Ahamed Khan | 1149. Sinus Dances | 29 Feb 2020 17:26 | 1 |
#include <bits/stdc++.h> int main() { int n,i,j,k; scanf("%d",&n); for(i=1; i<=n; i++){ if(i==1 && n!=1){ printf("("); } for(j=1; j<=i; j++){ if(i==1 && n==i){ printf("(sin(1))+%d",n); } else if(i==1){ printf("(sin(1)+%d)",n); } else { if(j%2==0){ printf("-sin(%d",j); } else if(j==1){ printf("sin(%d",j); } else { printf("+sin(%d",j); } if(j==i){ //printf(")"); for(k=1; k<=i; k++){ printf(")"); } } } } //if(i==n){ // printf(")"); // } if(i!=1 && i!=n){ printf("+%d)",n+1-i); } else if(i!=1 && i==n){ printf("+%d",n+1-i); } } return 0; } |