Problem 2979 --Fantastic Magic Cube

2979: Fantastic Magic Cube

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
You are given a positive integer NN and a set of six-tuples. We define the value of a six-tuple (lx,rx,ly,ry,lz,rz)(lx,rx,ly,ry,lz,rz) is ∑lx≤x≤rx,ly≤y≤ry,lz≤z≤rz,x⊕y⊕z∑lx≤x≤rx,ly≤y≤ry,lz≤z≤rz,x⊕y⊕z. In the beginning, the set has only an element (0,N−1,0,N−1,0,N−1)(0,N−1,0,N−1,0,N−1). You can do the following steps repeatedly until the size of SSequals to N3N3

∙∙ Pick a six-tuple (lx,rx,ly,ry,lz,rz)(lx<rxorly<ryorlz<rz)(lx,rx,ly,ry,lz,rz)(lx<rxorly<ryorlz<rz) from the set. 

∙∙ You can choose one element of {x,y,z}{x,y,z}

    ∘    ∘ Assuming you chose xx, it must be satisfied that lx<rxlx<rx. Then you should pick an integer t∈[lx,rx)t∈[lx,rx), erase (lx,rx,ly,ry,lz,rz)(lx,rx,ly,ry,lz,rz) from the set, add 
             (lx,t,ly,ry,lz,rz)(lx,t,ly,ry,lz,rz) and (t+1,rx,ly,ry,lz,rz)(t+1,rx,ly,ry,lz,rz) into the set, and you will get the product of values of these two new six-tuples. 

    ∘    ∘ Assuming you chose yy, it must be satisfied that ly<ryly<ry. Then you should pick an integer t∈[ly,ry)t∈[ly,ry), erase (lx,rx,ly,ry,lz,rz)(lx,rx,ly,ry,lz,rz) from the set, add 
             (lx,rx,ly,t,lz,rz)(lx,rx,ly,t,lz,rz) and (lx,rx,t+1,ry,lz,rz)(lx,rx,t+1,ry,lz,rz) into the set, and you will get the product of values of these two new six-tuples. 

    ∘    ∘ Assuming you chose zz, it must be satisfied that lz<rzlz<rz. Then you should pick an integer t∈[lz,rz)t∈[lz,rz), erase (lx,rx,ly,ry,lz,rz)(lx,rx,ly,ry,lz,rz) from the set, add 
             (lx,rx,ly,ry,lz,t)(lx,rx,ly,ry,lz,t) and (lx,rx,ly,ry,t+1,rz)(lx,rx,ly,ry,t+1,rz) into the set, and you will get the product of values of these two new six-tuples. 

Maximize the sum of values you got and output it modulo 998244353998244353

Note that ⊕⊕ means exclusive or, for more details refer tohttps://en.wikipedia.org/wiki/Exclusive_or.
There are multiple test cases. 

Each case starts with a line containing one positive integer N(N≤106)N(N≤106)

We guarantee that the sum of NNs in all test cases is no larger than 3×1063×106.
For each test case, output one line containing an integer denoting the answer.
2
6

推荐代码 查看2979 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$465 $ms] 淡意的温柔 575749 2020-03-31 09:42:25
内存最少[$13436 $KB] 淡意的温柔 575749 2020-03-31 09:42:25
第一AC 淡意的温柔 575749 2020-03-31 09:42:25
第一挑战 淡意的温柔 575749 2020-03-31 09:42:25

赛题来源/所属竞赛 2019 Multi-University Training Contest 2 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛