Today was my first competition(#326) and I was surprised, because my solution for the Div2 C problem was asymptotically optimal [O(N+M) where N is the number of weights and M is the maximum weight], but it was not accepted, because it failed the 11th test case because of being too slow.
After the competition, I examined the successful solutions of other participants and I was surprised to see that they have the exact same strategy. How is this possible?
fixed submission 13653920. cin is too slow without
ios_base::sync_with_stdio(false)