|
|
Show all threads Hide all threads Show all messages Hide all messages | This problem is pretty easy. Here is the test which helped me with WA 4 | Конобейцев Иван Олегович | 1904. The Lessons of the Past | 21 Feb 2023 17:13 | 1 | | WA 4 | Dmitri Belous | 1904. The Lessons of the Past | 31 Mar 2014 03:43 | 1 | WA 4 Dmitri Belous 31 Mar 2014 03:43 Try this test: 2 3 -1 Answer: 1 3 3 | so simple, but WA4? | ASK | 1904. The Lessons of the Past | 27 Jan 2014 16:20 | 2 | Since k <= 10 and |ai| ≤ 1000 the largest answer is 10001: let use -11000..11000 to be sure. Since the end of each segment is an integer such that on one side inequality holds and on the other it is not, the solution is trivial: just find all such points. Still the following program gives WA4. Any hint? #define I(x) int x; cin >> x #define FA(i,c) for(auto& i: c) #define FE(i,a,b) for(int i = (a); i <= (b); ++i) typedef vector<int> V; V a; bool in(double x){ FA(ai,a) x = fabs(x-ai); return x < 1; } int main(){ I(k); a.resize(k); FA(ai,a) cin >> ai; V b; FE(ix,-11000,11000) if(in(ix-0.1) != in(ix+0.1)) b.push_back(ix); cout << b.size()/2 << endl; for(size_t i = 0; i < b.size(); i += 2) cout << b[i] << ' ' << b[i+1] << endl; } < https://en.wikipedia.org/wiki/Line_segment>:a line segment is a part of a line that is bounded by two distinct end points In this problem, the end points of a "segment" are not required to be distinct (first occurrence in test 4). | clarification request | Mansurov Artur | 1904. The Lessons of the Past | 30 Dec 2013 00:49 | 2 | Input: 2 1 1 Output 1: 1 -1 3 Output 2: 2 -1 1 1 3 Какой из ответов правильный? | No subject | Check | 1904. The Lessons of the Past | 1 Feb 2013 00:03 | 1 | Edited by author 01.02.2013 09:18 | WA 4 | IgorKoval(from Pskov) | 1904. The Lessons of the Past | 15 Oct 2012 02:21 | 1 | WA 4 IgorKoval(from Pskov) 15 Oct 2012 02:21 if you get WA 4 and you solve the problem from the end, than (maybe) you must take into account that sensor return only possitive number or null ans intermediate value can be >= 0. Edited by author 15.10.2012 02:29 | объясните условия задачи(желатеьно +пример) | green_smile | 1904. The Lessons of the Past | 14 Oct 2012 00:58 | 1 | | No subject | green_smile | 1904. The Lessons of the Past | 13 Oct 2012 15:25 | 6 | Edited by author 14.10.2012 00:59 Edited by author 14.10.2012 00:59 числа из отрезка подходят под нормальный сигнал! Edited by author 14.10.2012 00:59 |
|
|
|