Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | Some help for C++ authors | 198808xc | 1575. Екатеринбургское метро 2 | 29 ноя 2023 19:24 | 8 | const int MaxLength = 30; const int Lines = 8; const int MaxStation = 15; const int Stations[Lines] = {13, 10, 11, 12, 9, 14, 15, 13}; const char Line[Lines][MaxStation][MaxLength + 1] = { {"7_klyuchey", "Sortirovochnaya", "China_town", "Zarechny", "City", "1905_year_square", "Kuybyshevskaya", "Sibirskaya", "Siniye_kamni", "Lechebnaya", "Varshavskaya", "Kompressornaya", "Koltsovo"}, {"Zelyony_ostrov", "Tatishchevskaya", "Verh_Isetskaya", "Kommunarov_square", "1905_year_square", "Teatralnaya", "Vostochnaya", "Vtuzgorodok", "Kamennye_palatki", "University"}, {"MEGA", "Metallurgov", "Kraulya", "Central_stadium", "Moskovskaya", "1905_year_square", "Shevchenko", "Pionerskaya", "Turbinnaya", "Elmash", "Taganskaya"}, {"Akademicheskaya", "Yugo_zapadnaya", "Volgogradskaya", "Posadskaya", "Geologicheskaya", "Teatralnaya", "Gagarinskaya", "Komsomolskaya", "Shefskaya", "Ozyornaya", "Italyanskaya", "Kalinovskaya"}, {"Sovhoznaya", "Voennaya", "Aviatsionnaya", "Dvorets_sporta", "Geologicheskaya", "Kuybyshevskaya", "Vostochnaya", "Gagarinskaya", "Vilonovskaya"}, {"Keramicheskaya", "Vtorchermet", "Samolyotnaya", "Botanicheskaya", "Parkovaya", "Mayakovskaya", "Oborony_square", "Kuybyshevskaya", "Teatralnaya", "Shevchenko", "Uralskaya", "Zvezda", "I_Pyatiletki_square", "Pobedy"}, {"Himmash", "Nizhne_Isetskaya", "Uktusskie_Gory", "Shcherbakovskaya", "Botanicheskaya", "Chkalovskaya", "Bazhovskaya", "Geologicheskaya", "1905_year_square", "Dinamo", "Uralskaya", "Mashinostroiteley", "Uralmash", "Prospekt_Kosmonavtov", "Bakinskih_Komissarov"}, {"Moskovskaya", "Kommunarov_square", "City", "Uralskaya", "Pionerskaya", "Gagarinskaya", "Vtuzgorodok", "Sibirskaya", "Oborony_square", "Bazhovskaya", "Dvorets_sporta", "Posadskaya", "Moskovskaya"} }; Thank you! You save my time. Thanks! :) Reformatted for C++ vector<vector<string>> a { {"7_klyuchey", "Sortirovochnaya", "China_town", "Zarechny", "City", "1905_year_square", "Kuybyshevskaya", "Sibirskaya", "Siniye_kamni", "Lechebnaya", "Varshavskaya", "Kompressornaya", "Koltsovo"}, {"Zelyony_ostrov", "Tatishchevskaya", "Verh_Isetskaya", "Kommunarov_square", "1905_year_square", "Teatralnaya", "Vostochnaya", "Vtuzgorodok", "Kamennye_palatki", "University"}, {"MEGA", "Metallurgov", "Kraulya", "Central_stadium", "Moskovskaya", "1905_year_square", "Shevchenko", "Pionerskaya", "Turbinnaya", "Elmash", "Taganskaya"}, {"Akademicheskaya", "Yugo_zapadnaya", "Volgogradskaya", "Posadskaya", "Geologicheskaya", "Teatralnaya", "Gagarinskaya", "Komsomolskaya", "Shefskaya", "Ozyornaya", "Italyanskaya", "Kalinovskaya"}, {"Sovhoznaya", "Voennaya", "Aviatsionnaya", "Dvorets_sporta", "Geologicheskaya", "Kuybyshevskaya", "Vostochnaya", "Gagarinskaya", "Vilonovskaya"}, {"Keramicheskaya", "Vtorchermet", "Samolyotnaya", "Botanicheskaya", "Parkovaya", "Mayakovskaya", "Oborony_square", "Kuybyshevskaya", "Teatralnaya", "Shevchenko", "Uralskaya", "Zvezda", "I_Pyatiletki_square", "Pobedy"}, {"Himmash", "Nizhne_Isetskaya", "Uktusskie_Gory", "Shcherbakovskaya", "Botanicheskaya", "Chkalovskaya", "Bazhovskaya", "Geologicheskaya", "1905_year_square", "Dinamo", "Uralskaya", "Mashinostroiteley", "Uralmash", "Prospekt_Kosmonavtov", "Bakinskih_Komissarov"}, {"Moskovskaya", "Kommunarov_square", "City", "Uralskaya", "Pionerskaya", "Gagarinskaya", "Vtuzgorodok", "Sibirskaya", "Oborony_square", "Bazhovskaya", "Dvorets_sporta", "Posadskaya", "Moskovskaya"} }; | | WA13 | Mortus | 1570. Ужин на 45 этаже | 28 ноя 2023 23:59 | 1 | WA13 Mortus 28 ноя 2023 23:59 Check how you restore the answer. I had the right price , but it brought out fewer dishes than necessary | | WA 13 | SharpBlade | 1779. Великая команда | 28 ноя 2023 18:09 | 2 | WA 13 SharpBlade 2 июн 2012 23:06 Can anyone say, what is wrong in my solution? public class T1779 { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int n=Integer.parseInt(in.readLine()); int sum=0; for(int i=0; i<n/2; i++){ for(int j=n-i-1; j<n; j++){ if(i!=j){ out.println((i+1)+" "+(j+1)); sum++; } } } System.out.println(sum); out.close(); } } Repalce the conditions i != j with i < j because you print some edges twice. Sorry for my bad English | | Gospers hack | Mahilewets Nikita [BSUIR] | 2024. Время приключений | 28 ноя 2023 16:07 | 2 | Very good opportunity to apply Gosper's hack trick. m is number of different colors in the input. Then iterate through all subsets of size k of m. It's really works. But I don't understand why this algo work. Can you explain me? | | WA6 | Mortus | 1701. Остап и партнёры | 28 ноя 2023 13:56 | 1 | WA6 Mortus 28 ноя 2023 13:56 I was getting wa6 because the salary[0] not equal to 0 | | Can he eat his brothers and sisters? | Artem Fursenko [Brainstorm] | 1242. Оборотень | 28 ноя 2023 12:42 | 3 | oh, i got AC. If anybody want to know - yes, he can! I got WA on test #5 can you tell me why? | | Test Case for WA#5 | azikar24 | 1242. Оборотень | 28 ноя 2023 12:36 | 3 | This test case helped me. 6 1 2 2 4 4 5 5 6 BLOOD 3 5 Answer: 0 Why answer is not a 1 2 4? Edited by author 13.04.2019 11:10 I have ans = 0 but although it giving WA on test #5 can you suggest me some error or another test case | | WA39 | arclite | 2078. Игра в боулинг | 28 ноя 2023 02:20 | 2 | WA39 arclite 30 окт 2018 21:03 Re: WA39 Olympic Bear (Nikolay Dubchuk) 28 ноя 2023 02:20 I didn't check that p[9] == 10 when p[8] == 10, where p[1]...p[10] - points Edited by author 28.11.2023 11:41 | | Easy | Mickkie | 1764. Транссиб | 25 ноя 2023 18:04 | 1 | Easy Mickkie 25 ноя 2023 18:04 No need to use simplex alg. Simple brute force linear programming done in O( Choose(10,4) * 4^3 ) time | | WA2 | Илья | 1211. Круговая порука | 25 ноя 2023 13:29 | 1 | WA2 Илья 25 ноя 2023 13:29 The 2nd test on the site does not pass, everything works for me, what should I do? | | note for WA#2 | hoan | 1211. Круговая порука | 25 ноя 2023 13:28 | 2 | try this test: input: 1 2 0 0 output: NO because for this sentences in the problem: "exactly one child has confessed the he (or she) had broken the cup". I dont notice to this and get WA#2. sorry for my poor english. GOOD LUCK! Edited by author 15.11.2010 23:48 I have a test on the website, no, what should I do? | | Cause of WA 9 | Ender | 1120. Сумма последовательных чисел | 24 ноя 2023 20:51 | 2 | The probable cause of the error is the use of a floating point variable for computing of value a. Any floating point types have limited precision, and looks like some times it is not enough. Consider to use some integer types instead. | | What 3rd test | Vsevolod | 2066. Простое выражение | 23 ноя 2023 17:01 | 1 | | | very good test to pass WA#13 | luckysundog | 1629. Перелёт | 23 ноя 2023 15:13 | 4 | it helped me to pass WA#13 3 1 0 60 12:00 2 1430 45 23:00 0:00 got AC | | Ok funny | TUITUF_Bahrom | 1295. Бред | 22 ноя 2023 17:48 | 2 | | | Some Deductions on the Problem | orzczt | 2061. OEIS A216264 | 22 ноя 2023 03:09 | 6 | If you search for the id "A216264" on oeis.org, you would find a table of a(n), n=1..60. One interesting thing is that the site said that it was Mikhail Rubinchik who calculated a(26) to a(60), which happened to be out of the brute-force range. What is really disappointing is that in this problem, n may be 61, I think it's that guys's trick to play with us. Another interesting fact is that this guy also invented and introduced the Palindromic Tree. So, I deduce that the solution to this problem is somehow related to this data structure. Edited by author 03.04.2016 12:56 Yes, with eertree you can bruteforce all answers My solution runs ~20 hours to generate result, it can be theoretically speed up 2 times by bruteforcing only strings such s<=reverse(s) How could you bruteforce 2^61 strings of length 61? imagine a binary tree of these strings, use DFS with eertree https://iq.opengenus.org/palindromic-tree-eertree/ Use custom allocator with fixed 128 Node. struct NodeAllocator { Node nodes[128]; int pos = 0; Node* allocate() { assert(pos < 128); return nodes + (pos++); } }; std::uint64_t rich_number(std::uint64_t val, int pos, int n, EerTree& tree) { if (pos >= n) return 1; std::int64_t res = 0; for (std::uint64_t bit = 0; bit < 2; ++bit) { std::uint64_t s = val | (bit << pos); /********************************************/ Node* t_current = tree.current; int t_pos = tree.alloc.pos; /********************************************/ int r = tree.insert(s, pos); /********************************************/ Node* cur_change = tree.cur_change; /********************************************/ if (r == 1) { res += rich_number(s, pos + 1, n, tree); } /********************************************/ //reset tree insert back tree.current = t_current; tree.alloc.pos = t_pos; if (r==1){ cur_change->labeled[bit] = nullptr; } /********************************************/ } return res; } ------------ rich_number(0, 0, 61) -> gives 61-rich palindrome. My computer it runs 52 hours. Это да, супер Edited by author 22.11.2023 03:10 | | easy bfs | 👑TIMOFEY👑`~ | 1101. Робот в поле | 20 ноя 2023 14:42 | 2 | | | Java Accepted | hostpol | 1068. Сумма | 20 ноя 2023 02:25 | 3 | import java.util.Scanner; public class Main { public static void main(String[] args) { int c = 0; Scanner n = new Scanner(System.in); int f = n.nextInt(); n.close(); if (f > 0) { for (int i = 1; i <= f; i++) c += i; System.out.println(c); } else if (f <= 0) { for (int i = f; i <= 1; i++) c += i; System.out.println(c); } } } Edited by author 13.01.2023 20:21 | | why wrong answer | Abduraxmon | 1068. Сумма | 20 ноя 2023 02:23 | 2 | #include <iostream> using namespace std; int sum(int a) { return ((1 + a)/2)*a; } int main () { int a;
cin >> a;
if (a > 0) cout << sum(a); else if (a < 0) cout << sum(abs(a)) * -1 + 1; else cout << 0;
return 0; } if N = 0 then you need add one so the correct solution is: if (a > 0) cout << sum(a); else if (a < 0) cout << sum(abs(a)) * -1 + 1; else cout << 1; | | WA7 | Mortus | 2009. Очереди в столовой | 17 ноя 2023 16:28 | 1 | WA7 Mortus 17 ноя 2023 16:28 If the i’th student will let the j’th student stand behind him in a line, this is !!!NOT!!! means that the j’th student will let the i’th student too. |
|
|