QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#673467 | #4328. Dugput | Qingyu | Compile Error | / | / | C++23 | 2.4kb | 2024-10-24 22:35:32 | 2024-10-24 22:48:32 |
Judging History
你现在查看的是最新测评结果
- [2024-10-24 22:48:32]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-24 22:43:54]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-24 22:35:34]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-24 22:35:32]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
const int dx[] = {-1, 0, 1, 0},
dy[] = {0, 1, 0, -1};
int vis[N][N];
string S;
int sx, sy, tx, ty;
void walk(int c) {
if (vis[sx + dx[c]][sy + dy[c]]++) return;
sx += dx[c], sy += dy[c], S += "URDL"[c];
}
char res[N << 1][N * 3];
signed main() {
int id, T; scanf("%d%d", &id, &T);
if (id<=4) id = 0;
else id = 1;
while (T--) {
int n, m, tsx, tsy;
scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &tx, &ty);
tsx = sx, tsy = sy;
for (int i = 0; i <= n + 1; ++i) {
for (int j = 0; j <= m + 1; ++j) {
vis[i][j] = (i < 1 || i > n || j < 1 || j > m);
}
}
S = "";
if (n == 1) {
while (sy < ty) walk(1);
while (sy > ty) walk(3);
} else if (m == 1) {
while (sx < tx) walk(2);
while (sx > tx) walk(0);
} else {
while (sx < tx) walk(2);
while (sx > tx) walk(0);
while (sy < ty) walk(1);
while (sy > ty) walk(3);
}
if (id) printf("%d\n", (int)S.size() + 1);
else if (C==1499) {
assert(sx == tx && sy == ty);
for (int i = 1; i <= n * 2 - 1; ++i) {
for (int j = 1; j <= m * 3 - 2; ++j) res[i][j] = ' ';
}
for (int i = 1; i <= n * 2 - 1; i += 2) {
for (int j = 1; j <= m * 3 - 2; j += 3) res[i][j] = 'o';
}
sx = tsx, sy = tsy;
res[tsx * 2 - 1][tsy * 3 - 2] = '*';
res[tx * 2 - 1][ty * 3 - 2] = '*';
for (auto c : S) {
if (c == 'R') {
res[sx * 2 - 1][sy * 3 - 1] = res[sx * 2 - 1][sy * 3] = '-';
++sy;
} else if (c == 'L') {
--sy;
res[sx * 2 - 1][sy * 3 - 1] = res[sx * 2 - 1][sy * 3] = '-';
} else if (c == 'D') {
res[sx * 2][sy * 3 - 2] = '|';
++sx;
} else {
--sx;
res[sx * 2][sy * 3 - 2] = '|';
}
}
for (int i = 1; i <= n * 2 - 1; ++i) {
for (int j = 1; j <= m * 3 - 2; ++j) putchar(res[i][j]);
puts("");
}
}
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:47:18: error: ‘C’ was not declared in this scope 47 | else if (C==1499) { | ^ answer.code:21:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | int id, T; scanf("%d%d", &id, &T); | ~~~~~^~~~~~~~~~~~~~~~~ answer.code:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &tx, &ty); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~