TWINSNOW - Snowflakes
English | Tiếng Việt |
Người ta nói rằng không có hai bông tuyết nào giống hệt nhau! Bạn hãy thử viết một chương trình nho nhỏ để kiểm tra xem điều này có đúng không nhé :D Mỗi bông tuyết được nhắc tới ở đây đều có 6 cánh, và hai bông tuyết được gọi là giống nhau nếu chúng có độ dài các cánh tương ứng bằng nhau ;)
Dữ liệu
- Dòng đầu tiên chứa số nguyên n là số bông tuyết cần kiểm tra.
- n dòng tiếp theo, mỗi dòng gồm 6 số nguyên (trong khoảng 0..107) là độ dài các cánh của bông tuyết tương ứng, được liệt kê theo thứ tự vòng quanh bông tuyết.
Kết quả
Nếu không có bông tuyết nào giống nhau, hãy ghi ra:
No two snowflakes are alike.
Nếu tìm được ít nhất một cặp bông tuyết giống nhau, hãy ghi ra:
Twin snowflakes found.
Ví dụ
Dữ liệu: 2 1 2 3 4 5 6 3 4 5 6 1 2 Kết quả: Twin snowflakes found.
Giới hạn
- 0 < n ≤ 105.
Bài không khó, để hẳn TimeLimit 2s, nhưng AC thì là cả một vấn đề tinh tế ;))
hide comments
olexg:
2020-12-14 21:10:30
Why is having a vector in which there is 12 different snowflakes for 1 given, and then sorting them using custom sort incorrect? It is giving me ac |
|
adrenaleon07:
2020-08-10 18:22:43
Well in my guess the correct logic is whatever u do u cannot change the neighbours of a particular arm.. so think like undirected graph and make nodes and save in vector(size will be 12) and use it as reference to find the duplicate.. in my guess this is the right approach.. neighbouring here is invariant.. eg.. for the above eg for 1 2 3 4 5 6 we have the vector as {{1,6},{6,1},{1,2},{2,1},{2,3},{3,2}....} and so on.. note: make sure to insert sorted vector in map. else it may not match..
|
|
Mitch Schwartz:
2014-05-24 00:34:05
"...but the incorrect logic... got AC on both the places which is definitely not right."
|
|
The_ROCK:
2014-05-23 19:46:36
I'm sorry but in my correct logic code(as to me it seems) I have considered both rotation and reversal which got me WA on a single testcase 2-b on the official site and thus here too but the incorrect logic(which sorts the six lengths) got AC on both the places which is definitely not right.
|
|
Mitch Schwartz:
2014-05-23 18:52:05
@Saurabh Prakash: You should have acknowledged the fact that your claim directly contradicts previous comments stating that the test data is merely weak (as opposed to wrong). You should also have mentioned that you are taking into account both rotation and reversal of the list of lengths, since that's not clear in (this version of) the problem statement. These things would give you more credibility. I'm not motivated to verify your claim at the moment, but maybe someone else will be.
|
|
The_ROCK:
2014-05-23 18:21:16
link to original problem statement of the contest.
|
|
Rishav Goyal:
2014-05-22 22:48:28
@Francky : Could u pls make the problem statement clear in comment. It seems something conflicting in the statements.
|
|
Rishav Goyal:
2014-05-22 22:17:40
(edit Francky)***********.that's all.
|
|
The_ROCK:
2014-05-17 09:30:36
This is very wrong. The correct logic i.e considering the lengths of arms of snowflakes in order (consecutive) is getting WA whereas the wrong logic i.e just sorting the six lengths is getting AC.
|
Added by: | AnhDQ |
Date: | 2009-05-11 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | CCC07 |