[problem:1345C] requires you to check if all `(i + arr[i]) % n` is distinct, so I did:↵
↵
~~~~~↵
for (int i = 0; i < n; i++) {↵
ll x;↵
cin >> x;↵
arr[i] = (i + x) % n;↵
s.insert(arr[i]);↵
}↵
cout << ((s.size() == n) ? "YES" : "NO") << '\n';↵
~~~~~↵
This got WA on test 2, whereas if I change it to:↵
↵
~~~~~↵
arr[i] = ((i + x) % n + n) % n;↵
~~~~~↵
This got AC. But aren't `(i + x) % n` and `((i + x) % n + n) % n` the same thing?↵
↵
~~~~~↵
for (int i = 0; i < n; i++) {↵
ll x;↵
cin >> x;↵
arr[i] = (i + x) % n;↵
s.insert(arr[i]);↵
}↵
cout << ((s.size() == n) ? "YES" : "NO") << '\n';↵
~~~~~↵
This got WA on test 2, whereas if I change it to:↵
↵
~~~~~↵
arr[i] = ((i + x) % n + n) % n;↵
~~~~~↵
This got AC. But aren't `(i + x) % n` and `((i + x) % n + n) % n` the same thing?↵