Test works on my local mac but fails when I submit it. I use xcode and C++. What are best practices when coding on mac with xcode in C++ in order to have compatible solutions?
Test works on my local mac but fails when I submit it. I use xcode and C++. What are best practices when coding on mac with xcode in C++ in order to have compatible solutions?
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
| Название |
|---|



Undefined Behaviour?
Check it out in the Customtest function to see what you get on Codeforces.
Besides, the problem might come from the differences between (Linux, Mac) and (Windows). You know, things like "%lld" and "%I64d".
I believe you're talking about your last submission: 14812227. Please include submission ID and link to the problem in the post — we don't read your mind and seeing the actual code makes helping significantly easier.
sort in C++ is not guaranteed to be stable, that is, if two elements are "equal" regarding to comparator, they can be ordered arbitrary in the output. For example, two consecutive calls of 'sort' do not make any sense. Use 'stable_sort' (which is somewhat slower) if you want stable sorting.
I think you wanted to sort pairs lexicographically. You'd better either make a single comparator which does all the job (i.e. checks for first items to be equal and then proceeds) or just do not pass any comparator at all — pairs are sorted lexicogrsphically by default.