{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"本题需要你模拟一些简单程序,每一个程序有以下5种指:\nvar \u003d val,给变量赋值,简单起见保证变量名为一个字母,变量为所有进程共用,并且初始为0,保证val是不大于100的正整数;\nprint var,输出变量var;\nlock对所有变量申请独占访问(不影响赋值和打印)\nunlock解除独占访问\nend结束程序\n以上指令分别耗时t1,t2,t3,t4,t5的时间,一开始进程按照输入顺序依次插入到等待队列中,每次从等待队列队首选择一个进程执行。每个进程有一个配额(限定时间)Q,当配额用完时,该进程会在执行完当前语句后立即被插入到一个等待队列尾部中。\n但是lock语句和unlock语句会改变进程的执行顺序。当一个程序执行了lock语句,其他进程再执行到lock语句时会被立即插入到一个阻止队列队尾,当程序执行到unlock语句时,阻止队列的队首的第一个进程会被立即插入到等待队列队首。"}},{"title":"","value":{"format":"MD","content":"\n第一行为测试数据组数\n第二行有7个正整数分别是程序数N(1\u003c\u003dN\u003c\u003d1000),t1,t2,t3,t4,t5,配额Q;\n接下来是N个程序,每个程序以end结尾,每个程序保证不超过25条指令"}},{"title":"","value":{"format":"MD","content":"输出所有print语句的结果格式id: val,id为进程编号(按照输入顺序且从1开始)每组测试数据之间应该有一行空行"}},{"title":"","value":{"format":"MD","content":"\n1\n3 1 1 1 1 1 1 \na \u003d 4\nprint a\nLock\nb \u003d 9\nprint b \nunlock \nprint b \nend \na \u003d 3\nPrint a \nlock \nb \u003d 8 \nprint b \nunlock \nprint b \nend \nb \u003d 5 \na \u003d 17 \nprint a \nprint b \nLock\nb \u003d 21 \nprint b \nunlock \nprint b \nend\n"}},{"title":"","value":{"format":"MD","content":"1: 3\n2: 3\n3: 17\n3: 9\n1: 9\n1: 9\n2: 8\n2: 8\n3: 21\n3: 21"}}]}