QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#879890 | #5414. Stop, Yesterday Please No More | The_8th_Horcrux | Compile Error | / | / | C++23 | 1.9kb | 2025-02-02 17:13:56 | 2025-02-02 17:13:59 |
Judging History
This is the latest submission verdict.
- [2025-02-02 17:13:59]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-02 17:13:56]
- Submitted
answer
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#define int long long
using namespace std;
constexpr int MAXN = 1005;
string op;
int n, m, k;
int U, D, L, R, U_, D_, L_, R_;
bool st[N][N];
int g[N][N];
void add(int x1, int y1, int x2, int y2){
if (st[x1][y1])
return;
st[x1][y1] = true;
g[x1][y1]++, g[x2 + 1][y1]--, g[x1][y2 + 1]--, g[x2 + 1][y2 + 1]++;
}
void solve() {
cin >> n >> m >> k >> op;
U_ = L_ = U = L = 1, R_ = R = m, D_ = D = n;
memset(st, false, sizeof st), memset(g, 0, sizeof g);
//确定边界
for (auto i: op){
if (i == 'L')
L_++, R_++;
else if (i == 'R')
L_--, R_--;
else if (i == 'U')
U_++, D_++;
else
U_--, D_--;
L = max(L, L_), R = min(R, R_), U = max(U, U_), D = min(D, D_);
}
//无袋鼠剩余情况
if (U > D || L > R){
if (k)
puts("0");
else
cout << n * m << endl;
return;
}
//统计袋鼠经过格子的情况
int x = (D - U + 1) * (R - L + 1), cnt = 0;
add(U, L, D, R);
for (auto i: op){
if (i == 'L')
L--, R--;
else if (i == 'R')
L++, R++;
else if (i == 'U')
U--, D--;
else
U++, D++;
add(U, L, D, R);
}
//二位前缀和+统计答案
for (int i = 1; i <= n; i ++ )
for (int j = 1; j <= m; j ++ )
g[i][j] += g[i - 1][j] + g[i][j - 1] - g[i - 1][j - 1];
for (int i = 1; i <= n; i ++ )
for (int j = 1; j <= m; j ++ )
if (x - g[i][j] == k)
cnt++;
cout << cnt << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int _;
cin >> _;
while (_ --) {
solve();
}
return 0;
}
Details
answer.code:15:9: error: ‘N’ was not declared in this scope 15 | bool st[N][N]; | ^ answer.code:15:12: error: ‘N’ was not declared in this scope 15 | bool st[N][N]; | ^ answer.code:16:7: error: ‘N’ was not declared in this scope 16 | int g[N][N]; | ^ answer.code:16:10: error: ‘N’ was not declared in this scope 16 | int g[N][N]; | ^ answer.code: In function ‘void add(long long int, long long int, long long int, long long int)’: answer.code:19:9: error: ‘st’ was not declared in this scope; did you mean ‘std’? 19 | if (st[x1][y1]) | ^~ | std answer.code:21:5: error: ‘st’ was not declared in this scope; did you mean ‘std’? 21 | st[x1][y1] = true; | ^~ | std answer.code:22:5: error: ‘g’ was not declared in this scope 22 | g[x1][y1]++, g[x2 + 1][y1]--, g[x1][y2 + 1]--, g[x2 + 1][y2 + 1]++; | ^ answer.code: In function ‘void solve()’: answer.code:28:12: error: ‘st’ was not declared in this scope; did you mean ‘std’? 28 | memset(st, false, sizeof st), memset(g, 0, sizeof g); | ^~ | std answer.code:28:42: error: ‘g’ was not declared in this scope 28 | memset(st, false, sizeof st), memset(g, 0, sizeof g); | ^