Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- //
- #define ll long long
- #define ull unsigned long long
- #define pb push_back
- #define mx 100010
- #define mod 1000000007
- #define inf INT_MAX
- #define pi acos(-1)
- #define endl '\n'
- #define fin freopen("input", "r", stdin)
- #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
- //
- int main() {
- ll n;
- cin >> n;
- ll ar[n];
- ll x, y, z;
- cout << "? 1 2" << endl;
- cout.flush();
- cin >> x;
- cout << "? 2 3" << endl;
- cout.flush();
- cin >> y;
- cout << "? 1 3" << endl;
- cout.flush();
- cin >> z;
- ar[0] = (x + z - y) / 2;
- ar[1] = x - ar[0];
- ar[2] = z - ar[0];
- for (ll i = 4; i <= n; i++) {
- cout << "? " << 1 << " " << i << endl;
- cout.flush();
- cin >> x;
- ar[i - 1] = x - ar[0];
- }
- cout << "! ";
- cout.flush();
- for (ll i = 0; i < n; i++) {
- cout << ar[i] << " ";
- cout.flush();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement