QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297069 | #2727. Gradient Descent | Camillus# | Compile Error | / | / | C++20 | 1.8kb | 2024-01-03 22:14:58 | 2024-07-04 03:16:39 |
Judging History
answer
/// @author Camillus <3
#ifndef LOCAL
#define debug(...) 42
#endif
#include "bits/stdc++.h"
using namespace std;
int query(int x, int y) {
cout << "? " << x << " " << y << endl;
int result;
cin >> result;
return result;
}
int answer(int s) {
cout << "! " << s << endl;
exit(0);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int R, C, L;
cin >> R >> C >> L;
int cnt = (query(0, 0) + query(R, C)) / (R + C);
int x, y;
{
int L = query(0, 0);
int R = query(R, 0);
auto get1 = [&](int k) -> int {
int cur = query(k, 0);
int a = (R + cur - k * cnt) / 2;
int b = (L + cur - k * cnt) / 2;
return a - b;
};
int l = 0, r = R;
while (r - l > 1) {
int m = (l + r) / 2;
if (get1(m) < 0) {
l = m;
} else {
r = m;
}
}
if (query(l, 0) < query(r, 0)) {
x = l;
} else {
x = r;
}
}
{
int L = query(0, 0);
int R = query(0, C)
auto get1 = [&](int k) -> int {
int cur = query(0, k);
int a = (R + cur - k * cnt) / 2;
int b = (L + cur - k * cnt) / 2;
return a - b;
};
int l = 0, r = C;
while (r - l > 1) {
int m = (l + r) / 2;
if (get1(m) < 0) {
l = m;
} else {
r = m;
}
}
if (query(0, l) < query(0, r)) {
y = l;
} else {
y = r;
}
}
answer(query(x, y));
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:67:9: error: expected ‘,’ or ‘;’ before ‘auto’ 67 | auto get1 = [&](int k) -> int { | ^~~~ answer.code:80:17: error: ‘get1’ was not declared in this scope; did you mean ‘getw’? 80 | if (get1(m) < 0) { | ^~~~ | getw