QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96728#2989. 一双木棋Alex100860 7ms16004kbC++141.2kb2023-04-15 09:35:522023-04-15 09:35:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-15 09:35:53]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:16004kb
  • [2023-04-15 09:35:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int a[11][11],n,m,b[11][11],tot;
struct edge
{
	int x,y;
}e[400005];
unordered_map <string,int> k;
vector<int> d[400005];
void init(string s)
{
	int res0=0,res1=0,rt=k[s];
	for (int i=1;i<=s.size();i++)
	{
		if (s[i]=='1')
		{
			res1++; 
			if (s[i-1]=='0') 
			{
				swap(s[i],s[i-1]);
				if (!k[s])
				{
					k[s]=++tot;
					e[tot].x=n-(res0-1),e[tot].y=res1;
//					cout<<s<<" "<<tot<<" "<<e[tot].x<<" "<<e[tot].y<<endl;
				} 
				d[rt].emplace_back(k[s]);
				init(s);
				swap(s[i],s[i-1]);
			}
		}
		else res0++;
	}
}
string s;
int res[400005][2],vis[400005][2];
int dfs(int u,int pl)
{
	if (vis[u][pl]) return res[u][pl];
	vis[u][pl]=1;
	int re=-1e9;
	if (!d[u].size()) re=0;
	for (auto v : d[u]) re=max(re,-dfs(v,pl^1));
	if (u==1) return re;
	int x=0;
	if ((pl^1)) x=a[e[u].x][e[u].y];
	else x=b[e[u].x][e[u].y];
	return res[u][pl]=re-=x;
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++) scanf("%d",&a[i][j]);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++) scanf("%d",&b[i][j]);
	s+='X';
	for (int i=1;i<=n;i++) s+='0';
	for (int i=1;i<=m;i++) s+='1'; 
	k[s]=++tot;
	init(s);
	cout<<-dfs(1,0);
	return 0;
} 

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 13592kb

input:

2 2
48316 18516
34352 3263
0 0
0 0

output:

37615

result:

wrong answer 1st lines differ - expected: '66832', found: '37615'

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 15700kb

input:

2 2
75925 18128
38471 42651
53412 27561
35202 23268

output:

149

result:

wrong answer 1st lines differ - expected: '35583', found: '149'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 15692kb

input:

2 2
68736 95419
18197 87453
0 0
0 0

output:

182872

result:

wrong answer 1st lines differ - expected: '86933', found: '182872'

Test #4:

score: 0
Wrong Answer
time: 2ms
memory: 15832kb

input:

3 3
30347 75845 36131
48118 6205 51826
7486 40480 58445
89340 63578 42185
78864 73882 44618
53322 6677 35054

output:

-60043

result:

wrong answer 1st lines differ - expected: '-8228', found: '-60043'

Test #5:

score: 0
Wrong Answer
time: 2ms
memory: 13736kb

input:

3 3
96942 46732 31592
65874 7883 73289
44414 59236 9197
0 0 0
0 0 0
0 0 0

output:

217487

result:

wrong answer 1st lines differ - expected: '255434', found: '217487'

Test #6:

score: 0
Wrong Answer
time: 5ms
memory: 15780kb

input:

3 3
28852 97109 77805
45967 58092 74930
95287 65144 94993
95970 74589 85144
18946 50383 94031
79115 82328 32425

output:

-65065

result:

wrong answer 1st lines differ - expected: '145621', found: '-65065'

Test #7:

score: 0
Time Limit Exceeded

input:

5 5
55928 35560 62780 77747 93320
2289 92078 11794 37512 63980
31076 40385 93729 16608 84575
21616 36427 52988 35960 23350
70170 30827 6468 46707 74459
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

5 5
69957 90847 86904 93073 40245
28329 60126 87118 6014 47716
44211 82632 7048 25316 18026
35996 66957 93148 28942 76653
24567 48573 21080 27648 79677
39142 22319 55890 94565 5578
43866 63511 78176 77389 67802
3878 89158 53308 62879 79293
72274 15472 6456 52791 12740
79970 46577 95439 33488 75518

output:


result:


Test #9:

score: 0
Time Limit Exceeded

input:

8 8
86108 81572 62938 40758 11532 21392 3581 2504
21005 70268 95734 70594 56220 90574 91914 5991
38371 69652 23397 46886 40865 53758 18445 39947
2301 13696 50188 33660 76692 5028 28616 79962
5316 54006 78086 86163 74562 7894 6618 13992
57283 96786 75838 91328 24732 66214 68383 61101
83739 36224 7365...

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

8 8
72263 8419 55507 20324 91755 52440 23833 40787
43896 76816 36755 55447 37493 25197 28806 8158
25187 67254 96533 11633 87146 19947 60933 61777
93331 60407 66650 81711 67421 75937 3204 31741
45644 25632 25607 79091 31101 58533 33858 39864
83305 9970 19125 98016 8962 25312 80555 98895
18430 43522 1...

output:


result:


Test #11:

score: 0
Wrong Answer
time: 6ms
memory: 15776kb

input:

10 1
26741
44875
46290
5961
14706
99723
79560
57538
8382
9583
0
0
0
0
0
0
0
0
0
0

output:

217680

result:

wrong answer 1st lines differ - expected: '175679', found: '217680'

Test #12:

score: 0
Wrong Answer
time: 5ms
memory: 15688kb

input:

10 1
8919
95688
93267
67099
7408
10592
47300
98255
90780
39444
25459
53053
67109
26951
85889
45189
75775
50663
66822
60054

output:

-9976

result:

wrong answer 1st lines differ - expected: '11764', found: '-9976'

Test #13:

score: 0
Wrong Answer
time: 7ms
memory: 16004kb

input:

10 2
66632 75577
25326 3304
12313 50122
45692 8004
43057 30880
27358 24369
19875 28212
13557 85685
49418 78047
261 93322
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

563022

result:

wrong answer 1st lines differ - expected: '303489', found: '563022'

Test #14:

score: 0
Wrong Answer
time: 7ms
memory: 14064kb

input:

10 2
25734 42462
8713 55503
20831 23987
70428 5903
83351 5980
83772 5612
42644 46237
43480 78535
19670 62712
53134 10822
39935 37169
12368 43173
12082 70592
94150 57635
92408 66732
34779 36045
36700 99138
18012 10524
94630 67847
53753 67290

output:

-175214

result:

wrong answer 1st lines differ - expected: '-147563', found: '-175214'

Test #15:

score: 0
Time Limit Exceeded

input:

10 3
54823 79443 61975
38396 80442 36722
39245 81935 39586
29086 91631 43723
10958 41722 76983
24586 36385 93874
55653 63080 84968
34760 64396 3608
30891 84631 40934
82340 61893 46524
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

output:


result:


Test #16:

score: 0
Time Limit Exceeded

input:

10 3
15434 56518 19173
63657 66591 25524
52687 46377 21073
25206 53123 66671
38596 34739 72614
96706 6021 85095
4124 89829 48403
38150 15093 18712
51382 24338 30286
47130 39038 3832
21965 29454 79841
14161 76084 5510
66024 38502 96571
85937 55212 56427
25329 62587 88640
41121 73634 66947
21217 32703...

output:


result:


Test #17:

score: 0
Time Limit Exceeded

input:

10 10
43160 45942 25141 50836 26666 78029 12721 4060 47766 38519
28905 65543 95241 88277 30507 45604 22707 25934 46518 13090
98505 23934 17519 85400 67853 49111 19614 75664 84998 98627
58475 42511 85657 39342 35060 66998 41228 16873 88181 36244
33724 98601 65211 64329 12231 25041 57657 33323 32086 9...

output:


result:


Test #18:

score: 0
Time Limit Exceeded

input:

10 10
70388 78095 16286 35188 72693 40763 98905 1023 65024 81842
53222 18629 20665 77097 41261 75861 40355 56217 80207 40759
77986 26227 84790 23663 93662 20282 61248 48145 68547 41170
64745 34107 19239 33868 8082 12212 50633 22908 30293 5248
33110 94868 72727 62632 96809 25113 85890 62667 43510 811...

output:


result:


Test #19:

score: 0
Time Limit Exceeded

input:

10 10
73014 81755 69006 80227 53814 27348 35895 72225 44812 88805
46580 26594 98521 91734 45006 95725 83991 93222 31280 42881
1930 4436 14909 30601 47389 69949 95259 44800 40302 49192
7321 87219 55625 68368 74472 97075 84918 24964 75871 34301
25844 4678 18311 10928 22967 77535 89398 18506 95071 6706...

output:


result:


Test #20:

score: 0
Time Limit Exceeded

input:

10 10
27529 95558 10391 83912 84199 11266 31322 29230 3717 17653
99818 93168 68278 68079 2991 59925 54348 68141 65949 46561
64979 83072 67821 31192 27141 9762 57620 88326 86972 90315
8756 61729 66442 11671 42697 15428 81717 40639 97733 75316
47835 12306 76669 33750 16018 7878 4065 57240 94357 18110
...

output:


result: