-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF.cpp
More file actions
44 lines (40 loc) · 902 Bytes
/
Copy pathF.cpp
File metadata and controls
44 lines (40 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#define fast ios::sync_with_stdio(false); cin.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int sz = 2e3;
int n;
int arr[sz];
ll ask(int l, int r) {
cout << "? " << l << " " << r << endl;
fflush(stdout);
ll ans;
cin >> ans;
return ans;
}
int main() {
fast;
cin >> n;
ll prv = ask(1, 2), bef = prv;
for (int i = 3; i <= n; i++) {
ll tmp = ask(1, i);
arr[i] = tmp - prv;
prv = tmp;
}
arr[2] = ask(2, 3) - arr[3];
arr[1] = bef - arr[2];
cout << "! ";
for (int i = 1; i <= n; i++)cout << arr[i] << " ";
return 0;
}