Warning: session_start(): open(/tmp/sess_6c9bdc59920e845bd75fa2b152d781f9, O_RDWR) failed: No space left on device (28) in /data/wiki/inc/init.php on line 239

Warning: session_start(): Failed to read session data: files (path: ) in /data/wiki/inc/init.php on line 239

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/auth.php on line 430
Writing /data/wiki/data/cache/d/de2edb2fcb553ea79b79c722a4e13dbc.captchaip failed

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/lib/tpl/dokuwiki/main.php on line 12
2020-2021:teams:mian:nowcoder_training:2020_multi-university_training_contest_7 [CVBB ACM Team]

用户工具

站点工具


2020-2021:teams:mian:nowcoder_training:2020_multi-university_training_contest_7

2020牛客暑期多校训练营(第七场)

Results

Summary

  • Solved 4 out of 10 problems
  • Rank 56 / 1140 in official records
  • Solved 6 out of 10 afterwards
#Who=PenaltyABCDEFGHIJDirt
7大吉大利,今晚吃 mian();4246+
01:03
-4+1
00:07
+1
00:37
+
01:39
33%
2/6

Member Distribution

Solved A B C D E F G H I J
Pantw
Withinlover O
Gary O

(√ for solved, O for upsolved, - for tried but not solved)


Solutions

A

B

C

D

本来想写 py,后来想一想直接猜只有 $n=1$ 和 $n=24$ 这两个解,就直接过了

E

F

G

H

这个题就是求

$$\sum\limits_{k=1}^{n}\left(2\lfloor\cfrac{n}{k}\rfloor+\left[n\bmod{k}\neq 0\right]\right)$$

直接数论分块即可。

I

J

直接按题意模拟即可。

点击以显示 ⇲

点击以隐藏 ⇱

struct Statement {
	
	enum Type {
		Alloc, Assign, Store, Load
	} type;
	
	struct Operand {
		
		enum Type {
			Variable, Object, Field
		} type;
		
		char str[3];
		
		int p0, p1;
		
		void determine() {
			if(str[1] == '.') type = Field, p0 = str[0] - 'A', p1 = str[2] - 'a';
			else if(islower(str[0])) type = Object, p0 = str[0] - 'a';
			else type = Variable, p0 = str[0] - 'A';
		}
		
	} left, right; 
	
	void determine() {
		if(left.type == Operand::Variable && right.type == Operand::Object) type = Alloc;
		else if(left.type == Operand::Variable && right.type == Operand::Variable) type = Assign;
		else if(left.type == Operand::Field && right.type == Operand::Variable) type = Store;
		else if(left.type == Operand::Variable && right.type == Operand::Field) type = Load;
	}
	
	int execute() {
		int ret = 0, pop;
		switch(type) {
			case Alloc:
				if(A[left.p0] & (1 << right.p0)) ret = 0;
				else A[left.p0] |= (1 << right.p0), ret = 1;
				break;
			case Assign:
				ret = __builtin_popcount(A[left.p0]);
				A[left.p0] |= A[right.p0];
				ret = __builtin_popcount(A[left.p0]) - ret;
				break;
			case Store:
				for(int i = 0; i < 26; ++i) {
					if(A[left.p0] & (1 << i)) {
						pop = __builtin_popcount(G[i][left.p1]);
						G[i][left.p1] |= A[right.p0];
						ret += __builtin_popcount(G[i][left.p1]) - pop;
					}
				}
				break;
			case Load:
				pop = __builtin_popcount(A[left.p0]);
				for(int i = 0; i < 26; ++i) {
					if(A[right.p0] & (1 << i)) {
						A[left.p0] |= G[i][right.p1];
					}
				}
				ret = __builtin_popcount(A[left.p0]) - pop;
				break;
		}
		return ret;
	}
	
} prog[233];

Comments

ptw:

  • 希望以后推式子的时候仔细一点,别再漏项了 (I)
2020-2021/teams/mian/nowcoder_training/2020_multi-university_training_contest_7.1596283974.txt.gz · 最后更改: 2020/08/01 20:12 由 grapelemonade