| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| TL in test 5 | oto | 1316. Биржа | 4 ноя 2019 22:16 | 2 |
I got time limit in test#5 and I can't find out why if you are using G++ 7.1 try using visual studios 2017 compiler. Apparently one works faster than the other |
| TLE22 | Kogut.Ivan | 2102. Миша и криптография | 4 ноя 2019 22:16 | 7 |
TLE22 Kogut.Ivan 20 ноя 2016 14:02 I get TLE on 22 test. What can you advise? 1)In solution you must find all primes <= 10^7. 2)You must use that n<=10^18. 1. find all primes up to 2 millions 2. if remainder > 2 millions, check if it is a prime Why do you take this number? big number N = X*Y*(p1*p2*p3*....*p18) = X*Y*(A) A = at least 2^18 = 262144 So, X*Y = at most 10^18 / 2^18 = 3 814 697 266 000 So either X or Y is less than 10^7 Edited by author 05.11.2019 20:56 Edited by author 05.11.2019 20:57 |
| A closer look! | Robert Otome | 1002. Телефонные номера | 4 ноя 2019 15:27 | 8 |
Each number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given. Each number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given. Can't believe!!!! Excellent idea!!!! If you can't go to the mountain, bring the mountain to you....wow what a statement! nice, but you must check such events: 1) word contains "ij" -> "11"(simple going letter by letter algorythm), that is not right it must transform into "1"( in dict "1":"ij"), but if word contains "ii" it must transform into "11". 2) if one word ends on some digit and another starts on it. we have words with "18" code and "89" code. Number "189". It depends, what letters words contain. There three alternatives: take both words, take with "18" or with "89". |
| Idea O(N) | Felix_Mate | 1056. Центры сети | 4 ноя 2019 15:11 | 2 |
I got AC! It's nice problem! My algo works at O(3*N)=O(N). 1)BFS from any vertex and find the most remote vertex (let V); 2)BFS from V and find the most remote vertex (let U); 3)Create path from U and V; vertex(vertexes) in the middle is answer. Edited by author 04.08.2015 12:56 |
| C answer | Rodrigo Munoz | 2100. Свадебный обед | 3 ноя 2019 21:43 | 1 |
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char name[20]; int N; scanf("%d", &N); int cost=200; int $=0; for(int i=0; i<N; i++) { scanf("%s", name); if(name[strlen(name)-4]=='+'&&name[strlen(name)-3]=='o'&&name[strlen(name)-2]=='n'&&name[strlen(name)-1]=='e') { cost=cost+200; } else { cost=cost+100; } } $=$+cost; if($==1300) { $=$+100; } printf("%d", $); return 0; } |
| Logic Explanation | Evans_DoN | 1243. Развод семи гномов | 3 ноя 2019 18:18 | 1 |
I got my code running due to the solutions posted.. But i want to understand the logic behind the division.. Any one? |
| Find Mistake ( If You Can !!! :D ) | Thunderbolt | 1263. Выборы | 3 ноя 2019 16:47 | 4 |
int main() { int n , m; cin >> n >> m; int *counter = new int [n]; for ( int i = 0 ; i < m ; i++ ) { int temp; cin >> temp; counter[temp-1]++; } for ( int i = 0 ; i < n ; i++ ) { float result = (float)counter[i] * (float)100 / (float)m; printf ("%.2f%%\n" , result); } delete[] counter; return 0; } (WA On Test 1) printf() also does the same work as cout<< I think the problem is from using int*counter.. Try using vector<int>counter(n); instead.. It worked fine when i tested it with the rest of your code |
| 37 Test | Novopashin | 2010. Юный гроссмейстер Саша | 2 ноя 2019 21:53 | 3 |
37 Test Novopashin 14 апр 2015 01:38 check your Knight with n = 3 Really nice tip, tvm bro. |
| Python 3, wrong answer although it works in Jupyter, why? | Liza | 1000. A+B Problem | 2 ноя 2019 15:04 | 3 |
a,b=input('Введите числа через пробел: ').split(" ") a=int(a) b=int(b) print(a+b) test 1, wrong answer :( Got it. The text in Russian was not a good idea. just this: a,b=input().split() a=int(a) b=int(b) print(a+b) accepted! Hello Lisa . It and my error ) a = float(input(" ")) b = float(input(" ")) print(a+b) Runtime error Rus : Привет , у меня такая же ошибка . Выдает Runtime error |
| RTE in Test #1. | Mushfiq Talha | 1086. Криптография | 2 ноя 2019 07:50 | 3 |
#include <iostream> using namespace std; int prime[15001]; bool num[163848]; void sieve() { num[2]=true; prime[1]=2; long int i,j,k; for(i=3;i<163848;i+=2) num[i]=1; for(i=2,j=3;i<=15000;j+=2) { if(num[j]) { for(k=j;k*j<=163848;k+=2) num[k*j]=0; prime[i]=j; i++; } } } int main() { sieve(); int t; cin>>t; while(t--) { int m; cin>>m; cout<<prime[m]<<endl; } } Why am I getting RTE in test #1? Edited by author 13.09.2019 08:33 Edited by author 18.08.2019 21:37 What is the size of int in this oj? 2 or 4 Bytes? |
| test 9 | Anna Misiewicz | 1546. Сортировка по-японски | 1 ноя 2019 17:47 | 1 |
test 9 Anna Misiewicz 1 ноя 2019 17:47 does anybody know anything about WA on that test? |
| I got AC in 0.125s and 284KB!!! | charlie | 1330. Интервалы | 1 ноя 2019 10:41 | 14 |
I got AC in 0.125s and 284KB!!! If you want my AC code,post me:happyzeyu@163.com Edited by author 25.12.2006 17:30 Edited by author 25.12.2006 17:30 I got AC in 0.109s abd 306KB!! Can I see your code? Post me:happyzeyu@163.com I got AC in 0.093 and 175KB :)) in russian that mean : "Пиписькомерство" 0.031 - 189 Kb Just "Пиписькомерство"! :) Pascal - 0.093s 154 КБ PS "Пиписькомерство" - +1 =)) pascal 0.093s 122k d**kcomparing)))) My Java solution got TLE#20, but my dick is still bigger no matter what. haha, I am spend 0.078s and 197 k If you want my AC code, send mail to k421668239@gmail.com "ПИписькомерство")))+1 but for what it???for me more important the result!!!!! not how it is!!!!!! sorry for my english) |
| Test case 6 - explained | ElPsyCongroo | 1787. Поворот на МЕГУ | 1 ноя 2019 09:35 | 13 |
If you have problems with test case 6, then please check the following: If you have wrong anwer at test 6, try this test: 4 3 3 4 5 Correct answer: 1 Because at ith minute, there is only a[i] cars come to the traffic jam. Good luck to you! Thanks to sign_in158. oh... i understand,thank you! I am very happy . Thank you . I am understand this Problem Thanks Edited by author 07.01.2015 01:03 Edited by author 21.02.2015 01:13 Edited by author 21.02.2015 01:14 Thank you. I understand now. |
| Some tests which will help during a program debug...(+) | Ivasyuk Roman [KPSU] (onlinehunter@gmail.com) | 1150. Номера страниц | 31 окт 2019 18:51 | 4 |
n=2984210864 21975 21818 11974 11967 11964 11964 11964 11907 11707 n=120 22 53 23 22 22 22 22 22 22 22 n=1000000000 788888898 900000001 900000000 900000000 900000000 900000000 900000000 900000000 900000000 900000000 n=1595999 887689 1594800 998800 998800 998800 994800 897800 897800 897800 893800 n=2009999 1112889 2204000 1214000 1204000 1204000 1204000 1204000 1204000 1204000 1204000 n=123456789 96021948 130589849 100589849 96589849 96089849 96029849 96022849 96022049 96021959 96021949 n=10000 2893 4001 4000 4000 4000 4000 4000 4000 4000 4000 n=20000 6893 18000 8001 8000 8000 8000 8000 8000 8000 8000 n=30000 10893 22000 22000 12001 12000 12000 12000 12000 12000 12000 n=9999 10893 22000 22000 12001 12000 12000 12000 12000 12000 12000 Thanks for the tests! I got AC :) But... I have some small correntions: 1) N <= 1 000 000 000, so N = 2 984 210 864 is an impossible test 2) for N = 9999 the right output is: 2889 4000 4000 4000 4000 4000 4000 4000 4000 4000 Also this one is a good test: 11 1 4 1 1 1 1 1 1 1 1 correct first test is n = 29842 ans 10864 21975 21818 11974 11967 11964 11964 11964 11907 11707 and n = 9999 0 2889 1 4000 2 4000 3 4000 4 4000 5 4000 6 4000 7 4000 8 4000 9 4000 I deduced the formula, but in numbers with zeros it does not work(( |
| C++ Why don't working WA #6 | dimfay | 1910. Руины титанов: сокрытый вход | 30 окт 2019 20:58 | 1 |
#include <iostream> #include <math.h> #include <iomanip> #include <vector> #include <map> #include <string> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<int> vec; for (int i = 0; i < n; i++) { int num; cin >> num; vec.push_back(num); } int max = 0; int sum = 0, seredina = 0; int index = 0; multimap<int, int> index_sum; for (int i = 2; i < vec.size(); i++) { sum = 0; if (vec[i] >= vec[i - 1] && vec[i - 1] >= vec[i - 2]) { sum += vec[i] + vec[i-1] + vec[i-2]; index_sum.insert(pair<int, int>(i, sum)); } } for (auto it = index_sum.begin(); it != index_sum.end(); it++) { if (it->second > max) { max = it->second; sum = max; seredina = it->first; } } cout << sum << " " << seredina; return 0; } Edited by author 30.10.2019 21:02 |
| ac 0.015 | Dyryaev Daniil | 1654. Шифровка | 30 окт 2019 15:05 | 1 |
ac 0.015 Dyryaev Daniil 30 окт 2019 15:05 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <algorithm> #include <set> #include <vector> #include <string> #include <cstdlib> using namespace std; void optimization() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } int main() { optimization(); string s; int k = -1; cin >> s; char c[200000]; for (char & i : c) { i = ' '; } for (char i : s) { if (k > -1) { if (c[k] == i) { c[k] = ' '; k--; } else { k++; c[k] = i; continue; } } else { k++; c[k] = i; } } for (char i : c) { if (i != ' ') { cout << i; } } return 0; } |
| Easy problem | Maksimus El Diablo | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:46 | 2 |
You can use Disjoint-set data structure. Too complicated for such an easy problem |
| WA #5 | redenventeria | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:45 | 3 |
WA #5 redenventeria 6 июл 2017 00:21 I can't help you without details of your algorithm. I have never encountered WA#5. I have some Stack-Overflow's because of critical mistake in my find_set function for Disjoint Set Union. After fixing AC. Edited by author 06.07.2017 09:50 You have to give us more information |
| Solved(MST) | Luka Bulatovic | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:43 | 5 |
Solution is Minimum spanning tree (Kruskal or Prim Algorithm). Put low cost on tunnels, and much higher one on bridges with using priority queue ;) The problem is much easier. You don't need to use Kruskal or Prim to solve it. Well, yes, but we can use this problem to train skills of writing MST algo =) You are trying to kill a fly with a nuclear Bomb :) Edited by author 30.10.2019 13:44 |
| Runtime Error #12 on Python3 | Tihon Molotkov`~ | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:40 | 2 |
It does not matter. Both DFS and BFS can be used to solve the problem. Yet, DFS code is shorter and nicer that BFS code. So, DFS is a better choice. So, I used DFS instead of BFS Edited by author 30.10.2019 13:41 Edited by author 30.10.2019 13:41 |