| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Wrong answer on test 28 | Emanuelco07 | 1723. Книга Сандро | 20 апр 2021 20:08 | 1 |
|
| if u have wa in test 3 | Abid29 | 1314. Погоня в метро | 20 апр 2021 14:46 | 1 |
try this one input: 3 2 61 62 5 75 20 85 50 61 3 10 20 30 1 5 output: 5 |
| Can someone give me answer to this testcase? | Danica Porobic | 1314. Погоня в метро | 20 апр 2021 14:07 | 7 |
4 3 75 85 20 2 61 62 5 75 20 85 50 61 3 10 20 30 3 30 20 85 Will answer include 75 or not? Why 75 does not fall into answer? Because no shortest route from 30 to 75 begins with 30,20,85 30->20->85->75 is one. Because no shortest route from 30 to 75 begins with 30,20,85 30->20->75 is shortest not your one Edited by author 20.04.2021 14:07 Edited by author 20.04.2021 14:07 |
| My solution in Python 3 took 0.062s and 220 KB. Can it be faster? | Dhruv Somani | 1545. Иероглифы | 19 апр 2021 15:39 | 3 |
My solution in Python 3 took 0.062s and 220 KB. Can it be faster? Of course it can! my solution took away just 0.001 sec and 172 kB(in C) Python takes more time than lower level languages and thats why it's not the best idea to use it in a speed based setting |
| hints | Abid29 | 1980. Путь к инвестору | 19 апр 2021 15:13 | 1 |
hints Abid29 19 апр 2021 15:13 just a binary search over overspeeding |
| WA#1 correct answer for sample out test 1 | Bobojon Bobojonov | 1263. Выборы | 19 апр 2021 12:27 | 1 |
object Election1263 extends App { val Array(n, m) = scala.io.StdIn.readLine().split(" ").map(_.toInt) val list = (0 to m - 1).foldLeft(List.empty[Int]){case (acc, _) => scala.io.StdIn.readLine().split("\n").map(_.toInt).toList match { case head :: Nil => acc :+ head case _ => acc } } val electionList = list.groupBy(identity).foldLeft(List.empty[Int]) {(s, e) => s :+ e._2.size } def getPersent(list: List[Int], list1: List[Double]) : List[Double] = list match { case head :: tail => getPersent(tail, list1 :+ head * 100.0 / m) case head :: Nil => getPersent(Nil, list1 :+ head * 100.0 / m) case _ => list1 } val result = getPersent(electionList, List()) result.foreach(e => println("%.2f".format(e) + "%") ) } |
| WA 1st test. I dont understand why. Help pls) | mrFOXY | 1226. йынтарбО кодяроп | 19 апр 2021 11:06 | 1 |
#include <iostream> #include <vector> #include <cmath> #include <string> #include <stack> using namespace std; string solve(string text) { string ts, cs = "", ans = ""; int i = 0; while (i < text.size()) { while(int(text[i]) >= 65 && int(text[i]) <= 122) { ts = ""; // create temp string ts.push_back(text[i]); // translate char to string cs.insert(0, ts); //reverse string i++; } if (i > 0 && int(text[i-1]) >= 65 && int(text[i-1]) <= 122) { ans += cs; //plus to out ans cypher word cs = ""; // make cypher word "" }
ans+=text[i]; i++; } ans += char(0x20); ans += char(0x0a); return ans; } int main() { string s; while(getline(cin, s)) cout << solve(s); } |
| WA2 | Alibi | 1471. Расстояние в дереве | 17 апр 2021 20:38 | 2 |
WA2 Alibi 23 фев 2015 20:33 What can it be, please? WA2 |
| TESTS | Solus | 1471. Расстояние в дереве | 17 апр 2021 19:40 | 1 |
TESTS Solus 17 апр 2021 19:40 5 0 1 1 0 2 1 1 3 1 1 4 1 2 3 2 4 3 ans: 3 2 5 1 0 1 2 0 1 3 1 1 4 1 1 2 2 3 4 3 ans: 3 2 3 2 1 1 0 2 1 3 0 0 0 1 1 1 ans: 0 2 0 5 0 1 1 0 2 2 1 3 3 1 4 1 2 2 3 4 3 6 4 ans: 6 4 8 0 1 1 0 2 1 2 3 1 3 4 1 0 5 1 5 6 1 6 7 1 6 7 7 1 4 4 4 4 3 3 4 7 0 ans: 0 4 0 1 1 3 5 0 1 1 1 2 1 3 0 1 0 4 1 4 0 4 4 0 0 2 2 0 ans: 1 1 2 2 Edited by author 17.04.2021 20:29 Edited by author 17.04.2021 20:50 Edited by author 20.04.2021 00:30 Edited by author 20.04.2021 00:41 Edited by author 20.04.2021 23:06 |
| It's simple | Cat36 | 1003. Чётность | 17 апр 2021 15:55 | 15 |
//main logic #include <stdio.h> #include <map> #include <iostream> using namespace std; map<int, bool> exist; map<int, bool> odd; map<int, int> prev; bool add(int a, int b, bool c){//b>=a; if (!exist[b]){ exist[b] = true; odd[b] = c; prev[b] = a; return true; }; int i = prev[b]; if(i==a) return (odd[b]==c); if(i<a) return add(i,a-1, (c!=odd[b])); return add(a,i-1, (c!=odd[b])); }; Thank you very much, at least I solved it! Nice problem! thank you! i study very from you Thanks! nice idea ;) I've got AC thank you very much!!!) Edited by author 01.11.2011 17:53 100 5 5 6 odd 7 8 odd 1 6 even 1 4 odd 7 8 even why result is 3 and not 4? because 1 1 = 0 but 0 0 not 1 the input format is verrrry misleading, i have lost 2 hours of my live because of it. #include <stdio.h> #include <map> #include <iostream> #include <string> using namespace std; map<int, bool> exist; map<int, bool> odd; map<int, int> previous; bool add(int a, int b, bool c){//b>=a; if (!exist[b]){ exist[b] = true; odd[b] = c; previous[b] = a; return true; }; int i = previous[b]; if(i==a) return (odd[b]==c); if(i<a) return add(i,a-1, (c!=odd[b])); return add(a,i-1, (c!=odd[b])); }; int main(int argc, char * argv[]) { while (1) { exist.clear(); odd.clear(); previous.clear(); int numbers = 0; cin >> numbers; if (numbers==-1) break; int questions = 0; cin >> questions; bool flag = false; for (int i = 0; i<questions; i++) { int a = 0; cin >> a; int b = 0; cin >> b; string tmp; cin >> tmp; bool parity = false; if (tmp=="even") { parity = true; } if ((add(a,b,parity)==false)&&(flag==false)) { cout << i; flag=true; } } if (flag==false) { cout << questions; } } return 0; } What wrong? I got wa at 1 test. Then run it in the debug mode and you'll figure it out. change bool parity = false; if (tmp=="even") { parity = true; } to bool parity = true; if (tmp=="even") { parity = false; } and then break after flag=true; Edited by author 21.03.2012 22:25 Edited by author 21.03.2012 22:25{ 100 5 5 6 odd 7 8 odd 1 6 even 1 4 odd 7 8 even why result is 3 and not 4? } I think the answer is 4, because [1,4] is odd and [5,6] is odd and [1,4],[5,6] are continuous then the answer isn't 3, but it is 4. Edited by author 02.05.2012 15:37 Edited by author 02.05.2012 15:40 Edited by author 02.05.2012 15:40 Good programing skills!! Thanks~ :0 this approach is out of my mind, great work!! |
| looks ok but wrong answer,why? | meherin | 2012. Про Гришу Н. | 16 апр 2021 17:55 | 2 |
#include<stdio.h> int main() {int f,left,time; scanf("%d",&f); left=12-f; time=left*45; if(time<=240){ printf("Yes");} else{printf("No"):} return 0;} else{printf("No"):} ; not : xd |
| If You have WA 13 | 107th | 1570. Ужин на 45 этаже | 16 апр 2021 13:44 | 3 |
look at overflow!!! in test 13 there are meny than 32 different dishes!!! my bug was: int h = j; ... d[i] |= (1 << h); change it to __int64 h = __int64(j); ... d[i] |= (__int64(1) << h); Edited by author 26.08.2008 17:18 Limit for dishes is 100. Why __int64 (64 bit) should be better than int (32 bit)? In both cases you need an array, don't you? |
| why wa on test 13/?? | leehark | 1570. Ужин на 45 этаже | 15 апр 2021 15:33 | 3 |
CAN SOME ONE GIVE ME SOME TEST? MY GMAIL: LIHE21327@GMAIL.COM First, DP needs to be 2D. Values array can be 1D, but backtracking info should be 2D. At least I couldn't make it 1D. And even after making parental state indication 2D I still had bugs in that back-traversal :) about wa 13 i am pretty sure its a problem with backtracking. |
| hints | Abid29 | 1965. Саженцы груши | 13 апр 2021 18:18 | 2 |
hints Abid29 13 апр 2021 18:16 its a greedy+dp according to me you should analyze the four scenario like 1. two increasing sequence :
take two array . two array initially have only one value zero. then iterate over 2nd to nth element. if element > 1st and 2nd arrays last element then, 1st sequence last element > 2nd arrays last element then: (add element to the 1st array) otherwise (add element to the 1st array) otherwise add it to the array whose last element < element
(this is optimal ). 2. two decreasing sequence: approach greedily like 1st one 3. one increasing and one decreasing(1st element included in the increasing array):(try yourself) 4. one increasing and one decreasing(1st element included in the decreasing array):(try yourself) for 3rd and 4th criteria , think greedily also. my solution is 0.14sec if you are better plz email me s-2017915104@isrt.du.ac.bd |
| WA2 Hint | Sukarna Paul | 1131. Копирование | 13 апр 2021 17:51 | 1 |
The program is already installed in one computer. Now, we need to install it in (N-1) computers. |
| In fact it's doubled Fibonacci sequence. Easy game. | Vyacheslav Glushkov | 1225. Флаги | 11 апр 2021 19:39 | 1 |
|
| AC tests | Gleb Dubosarskii | 1577. Электронная почта | 11 апр 2021 10:34 | 2 |
AC tests Gleb Dubosarskii 24 апр 2017 01:18 abc cba 6 aba bab 2 abcabc cba 5 abcbaabdca abcada 1 abcabbaca abcabbc 1 thnx a lot for your tests |
| it takes my days | Abid29 | 1696. Зарплата для роботов | 10 апр 2021 22:04 | 1 |
you can easily find the solution with O(nk^3) but it will give u tle after optimization with cumulative sum array it will be O(nk^2) |
| Right algo but too slow | Bekmuhamet | 1017. Лестницы | 9 апр 2021 19:01 | 2 |
import java.util.Scanner; public class Staircases { public static void main(String... args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); System.out.println(find_Q(N, N)); }
static int find_Q(int X, int Y) { int U = X-1; if(Y<X) { U = Y; if(Y == 0 || Y ==1) return 1; } if(Y<=1) return 0; int A = 0; for(int i = U; i > 0; i--) A += find_Q(i, Y-i); return A; } } Use bottom-up approach, calling function and return rakes huge amount of time |
| This task is driving me crazy | Zergatul | 1798. Огненный круг. Версия 2 | 8 апр 2021 01:51 | 2 |
I've implemented several approaches, ones calculate 1/4 of circle, another ones calculate 1/8 of circle. All of them works fine for R < 60000000. With R > 60millions there is a chance (and it increases with bigger R) 2 approaches can give different results. They use the same calculations (sqrt, ceiling). I also tried to implement 1/8 without float point numbers, by integers only. Same result with same difference. Maybe these "magic" numbers can help someone r: 67250001 correct: 14208049816923164 diff: 12 r: 67250051 correct: 14208070944129524 diff: 4 r: 67250211 correct: 14208138551359320 diff: 4 r: 67250249 correct: 14208154608083608 diff: 8 r: 67250321 correct: 14208185031387396 diff: 16 r: 67250433 correct: 14208232356606236 diff: 4 r: 67250449 correct: 14208239117361224 diff: 4 r: 67250505 correct: 14208262780007696 diff: 4 r: 67250601 correct: 14208303344588340 diff: 8 r: 67250697 correct: 14208343909213316 diff: 4 r: 67250769 correct: 14208374332717888 diff: 4 r: 67250825 correct: 14208397995480888 diff: 4 r: 67250835 correct: 14208402220968636 diff: 4 r: 67251315 correct: 14208605045441340 diff: 8 r: 67251347 correct: 14208618567139620 diff: 12 r: 67251457 correct: 14208665047975948 diff: 4 Edited by author 07.04.2021 02:35 Forget about what I said earlier. It is always good idea to return to the problem with fresh mind :) It turned out my correct solution was actually incorrect, and my incorrect solutions were correct. If you are using sqrt and ceil, try to calculate ceil(sqrt(2 * 63611501 * 67250001 - 63611501 * 63611501)), and you will get wrong result I was able to get AC C# solution with 467286474 int64 multiplications for R=10^9, no divisions, and no floating point usage. Edited by author 08.04.2021 01:53 Edited by author 08.04.2021 01:53 |