QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#375810 | #8553. Exchanging Kubic | SolitaryDream# | WA | 1ms | 3600kb | C++17 | 1.1kb | 2024-04-03 16:08:08 | 2024-04-03 16:08:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2010;
int n, a[N];
inline int Query(int l, int r) {
cout << "? " << l << ' ' << r << endl;
int ans = 0;
cin >> ans;
return ans;
}
inline void UpdMin(int &x, int y) {
x = min(x, y);
}
signed main() {
int Case;
cin >> Case;
while (Case--) {
cin >> n;
for (int i = 1; i <= n; ++i) a[i] = 1e15;
for (int round = 0; round < 2; ++round) {
for (int i = 1, la = 1, lasum = 0; i <= n; ++i) {
int rst = (round ? Query(n - i + 1, n - la + 1): Query(la, i));
if (rst == 0) {
UpdMin(a[i], -lasum);
la = i + 1;
lasum = 0;
} else {
UpdMin(a[i], rst - lasum);
lasum = rst;
}
}
reverse(a + 1, a + n + 1);
}
cout << "!";
for (int i = 1; i <= n; ++i) cout << ' ' << a[i];
cout << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
input:
2 3 1 1 1 1 1 1
output:
? 1 1 ? 1 2 ? 1 3 ? 3 3 ? 2 3 ? 1 3 ! 0 0 0
result:
wrong answer mss of [1, 1] is incorrect, expected=1, found=0 (test case 1)