아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Guess the Array

시간 제한2초메모리 제한512 MB

요약
Bob은 n번 이하의 구간 합 질의로 n개 정수 배열을 알아내야 하는데, 질의할 때마다 Alice가 한 구간을 막아 이후 그 구간은 다시 물을 수 없다.
난이도

보통10점 중 7점

유형
구간, 그리디, 수학, 구현
정답자
아직 제출이 없습니다

문제

This is an interactive problem. Your program will interact with the jury program using standard input and output.

Alice and Bob have decided to play a game called "Guess the Array". The rules of the game are very simple: Alice has an array of nn integers, and Bob has to guess this array by making no more than nn queries about the sums on the segments.

In one move Bob can make one of two types of queries to Alice:

  1. "? l r" to find out the sum of numbers on the segment of the array from the ll-th to the rr-th element inclusive;
  2. "!" to tell Alice that he is ready to give the answer. After this query Alice expects nn integers from Bob: the initial array.

For each first type query, Alice tells Bob the sum of the numbers in the requested segment. But to make it harder to guess, after each query Alice makes one segment blocked. In further queries, Bob cannot ask for the sum of the numbers on the blocked segments.

Help Bob guess Alice's array by making no more than nn first type queries.

예제1

  1. 예제 1

    입력
    3
    
    1 2 2
    
    3 2 3
    
    6 1 2
    
    
    
    예상 출력
    
    ? 1 1
    
    ? 3 3
    
    ? 1 3
    
    !
    1 2 3