QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#216629#5414. Stop, Yesterday Please No MoreddCompile Error//C++202.1kb2023-10-15 20:39:262023-10-15 20:39:27

Judging History

你现在查看的是最新测评结果

  • [2023-10-15 20:39:27]
  • 评测
  • [2023-10-15 20:39:26]
  • 提交

answer

Stop, Yesterday Please No More#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 10, M = 2e3 + 10;

int n, m, k;
set<pair<int, int> > a;
char st[N];
int sum[M][M];
int main() {
	int T; scanf("%d", &T);
	while (T--) {
		a.clear();
		scanf("%d%d%d", &n, &m, &k);
		for (int i = 0; i <= n; ++i)
			for (int j = 0; j <= m; ++j)
				sum[i][j] = 0;
		scanf("%s", st + 1);
		int U = 0, D = 0, L = 0, R = 0, x = 0, y = 0;
		int len = strlen(st + 1);
		for (int i = 1; i <= len; ++i) {
			if (st[i] == 'D')
				++x;
			if (st[i] == 'U')
				--x;
			if (st[i] == 'L')
				--y;
			if (st[i] == 'R')
				++y;
			a.insert(make_pair(-x, -y));
			U = max(U, -x);
			D = max(D, x);
			L = max(L, -y);
			R = max(R, y);
		}
	//	cout << U << ' ' << D <<' ' <<L << ' ' << R << endl;
		if (U + D >= n || L + R >= m) {
			if (k == 0)
				printf("%d\n", n * m);
			else
				printf("0\n");
			continue;
		}
	//	cout << U << ' ' << D << ' ' << L << ' ' << R << endl;
		++sum[U + 1][L + 1];
		--sum[n - D + 1][L + 1];
		--sum[U + 1][m - R + 1];
		++sum[n - D + 1][m - R + 1];
		for (set<pair<int,int> >::iterator it = a.begin(); it != a.end(); it++) {
			int xx1 = U + 1 - it->first, yy1 = L + 1 - it->second;
			int xx2 = n - D - it->first, yy2 = m - R - it->second;
			xx1 = max(xx1, 1);
			yy1 = max(yy1, 1);
			xx2 = min(xx2, n);
			yy2 = min(yy2, m);
			if (xx1 > n || yy1 > m || xx2 < 1 || yy2 < 1)
				continue;
		//	cout << it->first <<' ' <<it->second << endl;
		//	cout << xx1 << ' ' << yy1 <<' ' << xx2 << ' ' << yy2 << endl;
			++sum[xx1][yy1];
			--sum[xx2 + 1][yy1];
			--sum[xx1][yy2 + 1];
			++sum[xx2 + 1][yy2 + 1];
		}
		int ans = 0;
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= m; ++j) {
				sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
				if ((n - U - D) * (m - L - R) - sum[i][j] == k)
					++ans;
			}
	/*	for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= m; ++j)
				cout << (n - U - D) * (m - L - R) - sum[i][j] << ' ';
			cout << endl;
		}*/
		printf("%d\n", ans);
	}
	return 0;
}
/*
2
4 5 15
U
4 5 14
U
*/

詳細信息

answer.code:1:31: error: stray ‘#’ in program
    1 | Stop, Yesterday Please No More#include <bits/stdc++.h>
      |                               ^
answer.code:1:1: error: ‘Stop’ does not name a type
    1 | Stop, Yesterday Please No More#include <bits/stdc++.h>
      | ^~~~
answer.code:8:5: error: ‘pair’ was not declared in this scope
    8 | set<pair<int, int> > a;
      |     ^~~~
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:5: error: ‘pair’ was not declared in this scope
answer.code:8:1: error: ‘set’ does not name a type
    8 | set<pair<int, int> > a;
      | ^~~
answer.code: In function ‘int main()’:
answer.code:12:16: error: ‘scanf’ was not declared in this scope
   12 |         int T; scanf("%d", &T);
      |                ^~~~~
answer.code:14:17: error: ‘a’ was not declared in this scope
   14 |                 a.clear();
      |                 ^
answer.code:21:27: error: ‘strlen’ was not declared in this scope
   21 |                 int len = strlen(st + 1);
      |                           ^~~~~~
answer.code:1:1: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
  +++ |+#include <cstring>
    1 | Stop, Yesterday Please No More#include <bits/stdc++.h>
answer.code:31:34: error: ‘make_pair’ was not declared in this scope
   31 |                         a.insert(make_pair(-x, -y));
      |                                  ^~~~~~~~~
answer.code:32:29: error: ‘max’ was not declared in this scope
   32 |                         U = max(U, -x);
      |                             ^~~
answer.code:40:33: error: ‘printf’ was not declared in this scope
   40 |                                 printf("%d\n", n * m);
      |                                 ^~~~~~
answer.code:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | Stop, Yesterday Please No More#include <bits/stdc++.h>
answer.code:42:33: error: ‘printf’ was not declared in this scope
   42 |                                 printf("0\n");
      |                                 ^~~~~~
answer.code:42:33: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
answer.code:50:26: error: ‘pair’ was not declared in this scope
   50 |                 for (set<pair<int,int> >::iterator it = a.begin(); it != a.end(); it++) {
      |                          ^~~~
answer.code:50:22: error: ‘set’ was not declared in this scope; did you mean ‘st’?
   50 |                 for (set<pair<int,int> >::iterator it = a.begin(); it != a.end(); it++) {
      |                      ^~~
      |                      st
answer.code:50:31: error: expected primary-expression before ‘int’
   50 |                 for (set<pair<int,int> >::iterator it = a.begin(); it != a.end(); it++) {
      |                               ^~~
answer.code:50:68: error: ‘it’ was not declared in this scope; did you mean ‘st’?
   50 |                 for (set<pair<int,int> >::iterator it = a.begin(); it != a.end(); it++) {
      |                                                                    ^~
      |                                                                    st
answer.code:53:31: error: ‘max’ was not declared in this scope
   53 |                         xx1 = max(xx1, 1);
      |                               ^~~
answer.code:54:25: error: ‘yy1’ was not declared in this scope
   54 |                         yy1 = max(yy1, 1);
      |                         ^~~
answer.code:55:31: error: ‘min’ was not declared in this scope; did you mean ‘main’?
   55 |                         xx2 = min(xx2, n);
      |                               ^~~
      |                               main
answer.code:56:25: error: ‘yy2’ was not declared in this scope
   56 |                         yy2 = min(yy2, m);
      |                         ^~~
answer.code:78:17: error: ‘printf’ was not declared in this scope
   78 |                 printf("%d\n", ans);
      |                 ^~~~~~
answer.code:78:17: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?