진짜 뇌정진건지.. 56분 걸렸다. 테스트 케이스 이해하는데만 한세월 걸린 것 같다. 가장 거리 긴 것 부터 M개는 한번만 더하고, 나머지는 두번씩 더한다. 양수 영역 따로, 음수 영역 따로 계산해야하는데 어차피 0에 도착하면 리필되기 때문이다.#include #include#include #includeusing namespace std;long long N,M, book;//1 books;//-1 0 3 4 5 6 11//1+1+3+3+5+5+11 = 8 10 11//가장 거리 긴거부터 -M//56분long long dist;int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N >> M; books..