| Show all threads Hide all threads Show all messages Hide all messages |
| I don't know what is wrong with my code, could I use stack here? | JK Love | 1001. Reverse Root | 16 Feb 2024 11:59 | 2 |
#include <iostream> #include <stack> #include <cmath> using namespace std; int main() { stack<double> root; double input;
while(cin >> input) { root.push(sqrt(input)); }
while(!root.empty()) { cout << root.top() << endl; root.pop(); }
return 0; } Here your first input while is going infinnity. You have to stop it. |
| Tests | Mescheryakov_Kirill [SESC17] | 1348. Goat in the Garden 2 | 16 Feb 2024 02:29 | 2 |
Tests Mescheryakov_Kirill [SESC17] 24 May 2016 22:57 435 981 301 -384 -1 345 0 Correct answer: 371.78 789.08 thanks for the test found a mistake ( ˘ ³˘)♥︎ |
| Smallest possible automaton | Yury_Semenov | 1999. The secret module | 14 Feb 2024 16:19 | 1 |
My solution produces an automaton with 2n^2 + n states, but what is the smallest possible size? Is it still ~n^2? Edited by author 14.02.2024 16:19 |
| Yes Accepted 0.078s | Shen Yang | 1999. The secret module | 14 Feb 2024 16:16 | 10 |
worked at least two months.... I think it is a hard problem,harder than some rating>1e4 problems... How did you get the skill to solve such a hard problems? I know generic patterns to effective skill training Interested in particular case Edited by author 08.11.2017 21:17 Just stop solving easy problems,and trying harder one.. I start solving hard problems since year 2010 practicing at http://poj.org solving AC<100 problems and at year 2013 I start solving topcoder Div I 1000pts.. later I found codeforces and start solve fewest AC problems.. There are also some Chinese oj hardest problems is very hard such like http://www.lydsy.com/JudgeOnline/ http://uoj.ac/ Yeah, solving hard is very helpful, I felt it At some point I noticed that I am just not able to solve some harder problem Because it takes very much time to solve So even if trying whole day then cannot solve Maybe whole week is enough But very rarely have an opportunity to solve a problem the whole week Typical have only three hours per day But it's at cost of sacrificing important things So I feel like I cannot improve further Yeah, solving hard is very helpful, I felt it At some point I noticed that I am just not able to solve some harder problem Because it takes very much time to solve So even if trying whole day then cannot solve Maybe whole week is enough But very rarely have an opportunity to solve a problem the whole week Typical have only three hours per day But it's at cost of sacrificing important things So I feel like I cannot improve further you can choose some easier than hardest problems but harder than medium problems if you don't have enough time to practice On spoj.com I have lot of tasks in my TODO list... Why do you consider it a hard problem? It felt quite straightforward to me Timus has very few constructive problems (at least with difficulty >= 2000), so this problem may seem hard compared to others if constructive problems are not your strong point |
| How to test | Yury_Semenov | 1999. The secret module | 14 Feb 2024 16:13 | 1 |
Bruteforce all short numbers (i. e. length <= 3) and feed them to both input and output automata, then compare. Here are some useful tests: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 0 1 0 1 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8 3 0 1 0 1 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 |
| Many many tests | andreyDagger`~ | 1955. Boss, I Can See You! | 13 Feb 2024 22:59 | 1 |
These tests didn't help me figure out the issue, but maybe they can be useful for community 7 0 0 0 2 1 1 1 3 3 1 0 -1 -1 0 3.95284707521047407042 6 0 1 1 2 0 2 -1 1 -1 0 1 0 2.82842712474619029095 7 2 0 2 3 -2 3 -2 0 -2 -2 0 -2 2 -2 6.40312423743284853117 3 0 0 1 0 0 1 1.41421356237309514547 8 1 2 1 3 2 2 2 1 1 0 1 1 0 1 0 2 3.00000000000000000000 12 2 0 1 1 0 1 1 0 0 -2 -1 1 -1 2 0 2 -1 3 -4 0 0 -4 0 -1 6.79869268479037932229 12 2 0 1 1 0 1 1 0 -2 0 -1 1 -1 2 0 2 -1 3 -4 0 -3 -1 0 -1 6.00000000000000000000 7 0 0 1 2 1 1 3 1 1 -1 1 -3 -1 0 5.00000000000000000000 16 3 0 4 1 3 1 3 2 2 2 2 1 1 1 1 2 0 2 0 1 -1 1 -1 2 -2 2 -2 1 -3 1 -2 0 7.00000000000000000000 |
| How to get AC on C++ | LeTim | 1306. Sequence Median | 13 Feb 2024 14:44 | 1 |
1. Use scanf/printf instead of cin/cout 2. Use make_heap, push_heap and pop_heap instead of priority_queue 3. Use C-style array instead of vector 4. Do not allocate n elements for an array |
| its working in codeblocks so whats wrong?? | afia | 1068. Sum | 1 Feb 2024 21:33 | 1 |
#include<stdio.h> int main() { int i,n,sum; scanf("%d",&n); if(n>0) { for (i=1;i<=n;i++) { sum=sum+i; } printf("%d",sum); } if(n<0) { for (i=n;i<=1;i++) { sum=sum+i;} printf("%d",sum);} else if(n==0){ printf("not applicable");} } |
| Test #5 / Тест 5 ошибка - решение | Danil Morozov | 1192. Ball in a Dream | 31 Jan 2024 16:52 | 1 |
If you are getting an error on test 5 then use double instead of float. Если у вас ошибка при 5ом тесте, используйте переменные double вместо float. |
| WA 3 | Raphael Osipov | 1127. Colored Bricks | 31 Jan 2024 14:45 | 1 |
WA 3 Raphael Osipov 31 Jan 2024 14:45 |
| WA 7 | Catalin Cocis | 1232. Asteroid Landing | 27 Jan 2024 15:52 | 2 |
WA 7 Catalin Cocis 23 Apr 2010 23:34 I had WA7 when I computed maximal rotation angle incorrectly. |
| WA2 | Yury_Semenov | 1473. Farm 2 | 25 Jan 2024 12:48 | 1 |
WA2 Yury_Semenov 25 Jan 2024 12:48 |
| What is test#3 | bilibilitdasc | 1655. Somali Pirates | 24 Jan 2024 13:13 | 2 |
I kept getting wrong answer in test#3. What should I do? |
| I think this problem really needs a clearer statement and an explanation of the sample | 337446ZX | 1267. Yekaterinburg Subway | 24 Jan 2024 09:01 | 3 |
I will post one if I solve it. There are n subway stations on a subway line, numbered from 1 to n. The distance between the ith station and the i+1th station is s_i, which means the train need s_i minutes to drive from the ith station to the i+1th. There are trains driving from 1 to n and trains driving from station n to station 1. The trains driving from station 1 to station n departs every d minutes at station 1 and the first one of that departs at d1 minutes. Similarly, The trains driving from station n to station 1 departs every d minutes too at station n and the first one of that departs at dn minutes. However, in this problem the trains are considered not to stay at any station, just drive past A vistor is going to visit every station. He starts from station t. To visit a station, he has to take a train and get off at that station. It takes him 1 minutes to visit a staion, so that he cannot take the train he get off just now. The station t is considered visited. After all visits he need to return to station t. You are going to make a plan for him so that the time cost is minimized. The time cost is calculated as (the time he has visited all stations and gets off a train to station t - the time he departs--getting on a train at station t (can be any train)). Output such time in minutes. Input n s_1 s_2 ... s_(n-1) t d d1 dn Edited by author 24.01.2024 09:02 Explanation of the sample: One possible solution. Take the train to n at 5 and get of to station 3 at 12. Then take the train to 1 at 13 and get of to station 1 at 25. Then take the train to n at 28 and get of to station 2 at 33. It costs 33-5=28 Edited by author 24.01.2024 09:05 |
| WA4 | andreyDagger`~ | 2173. Meta-statement 3 | 24 Jan 2024 08:03 | 2 |
WA4 andreyDagger`~ 28 Jul 2023 21:08 Pay attention to: "wants to see the name of their company in the exactly s_i DIFFERENT problem statements" |
| WA25 | Mortus | 1286. Starship Travel | 15 Jan 2024 14:03 | 1 |
WA25 Mortus 15 Jan 2024 14:03 |
| WA10 | andreyDagger`~ | 2079. Memory leaks | 15 Jan 2024 00:50 | 1 |
WA10 andreyDagger`~ 15 Jan 2024 00:50 |
| WA7 | Mortus | 1608. Lucky Tickets 2008 | 12 Jan 2024 00:41 | 1 |
WA7 Mortus 12 Jan 2024 00:41 |
| What wrong? (с++) | Plotnik | 1001. Reverse Root | 11 Jan 2024 19:59 | 1 |
#include <iostream> #include <algorithm> #include <iomanip> #include <string> #include <vector> #include <cmath> using namespace std; int main() { double element, a; vector<double> numbers; while (cin >> element) { numbers.push_back(element); } reverse(numbers.begin(), numbers.end()); for (size_t i = 0; i != numbers.size(); i++) { a = sqrt(numbers[i]); cout << setprecision(4) << a << "\n"; } return 0; } Edited by author 11.01.2024 20:23 |
| Graph | zhnzhang61 | 1225. Flags | 11 Jan 2024 07:56 | 1 |
Graph zhnzhang61 11 Jan 2024 07:56 n = 1 2 3 4 5 R RW RWR RWRW RWRWR W WR WRW WRWR WRWRW RBW RBWR RBWRW WBR WBRW WBRWR RWBR RWBRW WRBW WRBWR RWRBW WRWBR RBWBR WBRBW Each column can be derived from: 1. the column on its left + R or W and 2. the column on its left's left + BR or BW |