A ballistic missile fired from a North Korean submarine on Wednesday flew about 500 kilometers (310 miles), the longest distance achieved by the North for such a weapon, Seoul officials said, putting all of South Korea, and possibly parts of Japan, within its striking distance.