| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| How could we solve this problem by DP? | HowieMa | 1073. Квадратная страна | 29 мар 2020 14:23 | 3 |
We could solve it by Theorem on the sum of four squares, I wonder how to solve it by DP? If you know, please help me, thank you! We could solve it by Theorem on the sum of four squares, I wonder how to solve it by DP? If you know, please help me, thank you! Well... For n=72... what are the possible squares you can take? You can take 64,49,36,25...4,1 . So what's the best result for 72? The best result Best(72)=min(Best(72-64),Best(72-49),Best(72-36), ... Best(72-1))+1; Now whats the base cases? U see, for all square numbers, u can take it in one go. So Best(1)=Best(4)=Best(9)=Best(16) ... = 1 Its a top down approach. I hope u got the idea... Goodluck. Btw, I'm wondering how u solved by Theorem on the sum of four squares. Can u send your code to my mail please? ealham86@gmail.com i solved it with dp. but i wondered with u.plz send me ur code. EMAIL:achowdhury@isrt.ac.bd |
| Give 13 test please | vtalgo20_egurin | 1628. Белые полосы | 29 мар 2020 01:52 | 1 |
I failed on 13 test and I can't found error. Please give a 13 test. |
| Agree? Found out the game? | Kairom `Ekexity 💻 | 2148. Безумный выстрел | 28 мар 2020 14:47 | 2 |
|
| WA on TEST 20 | Ashiqur Rahman Nayeem | 1684. Последнее слово Джека | 28 мар 2020 04:35 | 2 |
|
| WA 44 | СуБаЕг | 2112. Полевые логи | 28 мар 2020 02:26 | 2 |
WA 44 СуБаЕг 19 ноя 2019 23:09 Edited by author 19.11.2019 23:33 Edited by author 19.11.2019 23:44 |
| Math explanation | mberdyshev | 1214. Странная процедура | 27 мар 2020 22:02 | 2 |
We are given positive x and y. Let's go in the first loop. Let's do some method refactoring for better understanding: y0 = x*x+y; x0 = x*x+y0; y1 = sqrt(x0+(y0/labs(y0))*(-labs(y0))); for (j = 1; j <= 2*y1; j++) x0 = x0-y1; x = x0; y = y1; Let's go through the lines: y0 = x*x + y Next: x0 = x*x + y0 = 2*x*x + y As y0 > 0 (x, y are positive) => y0/labs(y0) = 1 So y1 = sqrt(x0+(y0/labs(y0))*(-labs(y0))) = sqrt(x0-labs(y0)) = sqrt(2*x*x + y - (x*x + y)) = sqrt(x*x) = x Next 2 lines equals to this: x0 = x0 - 2*y1*y1 = 2*x*x + y - 2*x*x = y So, x=y and y=x. x and y are swapped. After that you need to count amount of swaps and print appropriate answer |
| Could you give me some tests? | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1660. Остров Невезения | 26 мар 2020 00:26 | 5 |
Could somebody who solved this problem give some tests to me? WA #7 :( Also asking for some random tests, because it's hard to check the solution. random test: 25 7 3 4.0671982122 good luck =) 100 2 20 0.00000 100 98 1 0.12311156 85 17 53 2.1738219 |
| I think my solution is right but they don't accept it , help? | Ore Sama | 2066. Простое выражение | 25 мар 2020 14:01 | 2 |
#include <stdio.h> int main(){ int a,b,c; scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); if (a>b){ if (b>c){ printf("%d",c-(a*b)); } else{ printf("%d",b-(a*c)); } } if(b>a){ if (a<c){ printf("%d",a-(c*b)); } } return 0; } 1) a,b,c sequence is already sorted. 2) Try "1 1 1" input. Answer is -1. |
| Use next_permutation | Dmitry Vaskin`~ | 2011. Длинное условие | 24 мар 2020 21:29 | 2 |
I used next_permutation and get AC i used next_permutation and got TLE |
| *** COUNTRIES RANKLIST *** | tainic | | 24 мар 2020 19:52 | 2 |
Hi, I made a countries ranklist here: http://acmtimusru.appspot.com It lists the countries by rating, solved, users or last ac, where: - rating = sum(user.rating) for user in a country - solved = sum(user.solved) for user in a country - users = count of users in a country - last ac = the most recent accepted submission of any user in a country Also, clicking on a country gives you a ranklist of users in that specific country. The ranklists are updated hourly. Enjoy! Edited by author 24.03.2020 14:51That's nice. Thank your for sharing your effort with us! God bless Antarctica! Edited by author 24.03.2020 19:53 |
| WA #15 | Flamethrower0627 | 1104. Не спрашивай даму о возрасте | 20 мар 2020 19:31 | 1 |
WA #15 Flamethrower0627 20 мар 2020 19:31 Can anybody help Edited by author 20.03.2020 19:35 |
| Wrong Answer Test Case #1 | skartik | 2018. Дебютный альбом | 17 мар 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 мар 2020 21:20 | 1 |
Is it possible to change the judge id? Thanks |
| WA#1 | mushfiq | 1022. Генеалогическое дерево | 13 мар 2020 13:08 | 3 |
WA#1 mushfiq 27 окт 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. Куча орехов | 12 мар 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. Дональд-почтальон | 12 мар 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 | mmd18cury | 1353. Миллиардная Функция Васи | 11 мар 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. Простое выражение | 10 мар 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++ | mmd18cury | 1644. Куча орехов | 9 мар 2020 01:40 | 1 |
AC C++ mmd18cury 9 мар 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. Выборы | 6 мар 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. |