QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#879900 | #5414. Stop, Yesterday Please No More | The_8th_Horcrux | Compile Error | / | / | C++23 | 1.9kb | 2025-02-02 17:19:04 | 2025-02-02 17:19:05 |
Judging History
This is the latest submission verdict.
- [2025-02-02 17:19:05]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-02 17:19:04]
- Submitted
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int MAXN = 1005;
string op;
int n, m, k;
int U, D, L, R;
int U0, D0, L0, R0;
bool st[MAXN][MAXN];
int g[MAXN][MAXN];
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 t;
cin >> t;
while(t--) {
solve();
}
return 0;
}
详细
answer.code: In function ‘void solve()’: answer.code:29:5: error: ‘U_’ was not declared in this scope; did you mean ‘U0’? 29 | U_ = L_ = U = L = 1, R_ = R = m, D_ = D = n; | ^~ | U0 answer.code:29:10: error: ‘L_’ was not declared in this scope; did you mean ‘L0’? 29 | U_ = L_ = U = L = 1, R_ = R = m, D_ = D = n; | ^~ | L0 answer.code:29:26: error: ‘R_’ was not declared in this scope; did you mean ‘R0’? 29 | U_ = L_ = U = L = 1, R_ = R = m, D_ = D = n; | ^~ | R0 answer.code:29:38: error: ‘D_’ was not declared in this scope; did you mean ‘D0’? 29 | U_ = L_ = U = L = 1, R_ = R = m, D_ = D = n; | ^~ | D0