QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#717136 | #8981. Kangaroo Puzzle | KobicGend | Compile Error | / | / | C++20 | 1.4kb | 2024-11-06 17:01:15 | 2024-11-06 17:01:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
const string dir = "DRUL";
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
vector<vector<int>> E(n * m);
auto change = [&](int x, int y) {
return x * m + y;
};
auto get = [&](int p) {
return pair(p / m, p % m);
};
int sx = -1, sy = -1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (s[i][j] == '1') {
sx = i, sy = j;
}
}
}
vector vis(n, vector<int>(m));
string path;
if (sx != -1) {
auto dfs = [&](this auto&& self, int x, int y) -> void {
//cerr << "dfs " << x << " " << y << endl;
for (int i = 0; i < 4; i++) {
auto [nx, ny] = pair(x + dx[i], y + dy[i]);
if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;
if (s[nx][ny] == '0') continue;
if (vis[nx][ny]) continue;
vis[nx][ny] = 1;
path += dir[i];
self(nx, ny);
}
};
vis[sx][sy] = 1;
dfs(sx, sy);
}
cout << path << endl;
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:42:24: error: expected identifier before ‘this’ 42 | auto dfs = [&](this auto&& self, int x, int y) -> void { | ^~~~ answer.code:42:24: error: expected ‘,’ or ‘...’ before ‘this’ answer.code: In lambda function: answer.code:45:38: error: ‘x’ was not declared in this scope; did you mean ‘sx’? 45 | auto [nx, ny] = pair(x + dx[i], y + dy[i]); | ^ | sx answer.code:45:49: error: ‘y’ was not declared in this scope; did you mean ‘sy’? 45 | auto [nx, ny] = pair(x + dx[i], y + dy[i]); | ^ | sy answer.code:51:17: error: ‘self’ was not declared in this scope 51 | self(nx, ny); | ^~~~ answer.code: In function ‘int main()’: answer.code:55:12: error: no match for call to ‘(main()::<lambda(int)>) (int&, int&)’ 55 | dfs(sx, sy); | ~~~^~~~~~~~ answer.code:42:20: note: candidate: ‘main()::<lambda(int)>’ 42 | auto dfs = [&](this auto&& self, int x, int y) -> void { | ^ answer.code:42:20: note: candidate expects 1 argument, 2 provided