QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617795#5140. Frozen ScoreboardDoubeecatWA 7ms3576kbC++203.2kb2024-10-06 17:08:112024-10-06 17:08:13

Judging History

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

  • [2024-10-06 17:08:13]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3576kb
  • [2024-10-06 17:08:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int m;
int totp,tott,lstpr;
bool vis[20];
struct prob {
	int typ,attpt,tim,rt;
}P[20];

bool check(int x) {
	int minn = 0,maxx = 0;
	int nowt = tott;
	for (int j = 0;j < m;++j) {
		if (!((x >> j) & 1)) continue;
		/*
			P[i].attpt = nowatp;
			P[i].rt = subtim-nowatp;
			P[i].tim = 240 + P[i].rt * 20;
		*/
		int fhtj = P[j].rt;
		nowt -= 240 + (fhtj) * 20;//最小消耗的罚时先给他干掉了 接下来就只需要考虑 240 + x的 x部分即可 
		//nimade nowt要扣掉的是 
		minn += 240 + (fhtj) * 20;
		maxx += 299 + (P[j].rt+P[j].attpt-1) * 20;
	}
	//puts("nowt");
	//cout <<tott <<"\n";
	//cout <<minn <<" " <<maxx << "\n";
	if (tott < minn || tott > maxx) return 0;
	
	for (int j = 0;j < m;++j) {
		if ((x >> j) & 1) {
			P[j].typ = 2;
			
			int nowc = min(nowt / 20,P[j].attpt-1);
			if (nowc) {
				P[j].attpt = P[j].rt + nowc + 1;
				nowt -= nowc * 20;
				
				P[j].tim = 240 + min(nowt,59);
				nowt -= min(nowt,59);
			} else {
				P[j].attpt = P[j].rt + 1;
				P[j].tim = 240 + min(nowt,59);
				nowt -= min(nowt,59);
			}
			/*
			P[j].tim = min(nowt,59) + 240;
			nowt -= min(nowt,59);
			P[j].attpt = P[j].rt+1;
			*/
		} else {
			if (!vis[j]) P[j].typ = 3;
		}
	}
	return 1;
}

void solve() {
	cin >> totp >> tott;
	lstpr = 0;
	//cout <<m << " "<<totp << " "<<tott; 
	memset(vis,0,sizeof vis);
	memset(P,0,sizeof P);
	for (int i = 0;i < m;++i) {
		char opt;cin >> opt;
		//cout << "opt:" <<opt <<"\n";
		if (opt == '.') {
			P[i].typ = 1;
			vis[i] = 1;
		} else if (opt == '+') {
			P[i].typ = 2;
			int nowatp,subtim;
			char qwq;
			cin >> nowatp >>qwq>> subtim;
			//cout << nowatp << " " <<subtim <<"\n"; 
			P[i].attpt = nowatp;P[i].tim = subtim;
			int nowtt = (nowatp - 1) * 20 + subtim;
			tott -= nowtt;
			++lstpr;
			vis[i] = 1;
		} else if (opt == '-') {
			P[i].typ = 3;
			cin >> P[i].attpt;
			vis[i] = 1;
		} else {
			P[i].typ = 4;
			int nowatp,subtim;
			cin >> nowatp >> subtim;
			P[i].attpt = nowatp;
			P[i].rt = subtim-nowatp;
			P[i].tim = 240 + P[i].rt * 20;
		}
		//printf("p:%d %d %d\n",P[i].typ,P[i].tim,P[i].attpt);
	} 
	
	bool finaa = 0;
	for (int i = 0;i < (1 << m);++i) {
		bool flag = 0;
		int cnt = 0;
		for (int j = 0;j < m;++j) {
			if (!((i >>j) & 1)) continue;
			if (vis[j]) {
				flag = 1;
				break;
			}
			++cnt;
		}
		//判断题数是否相同捏 
		//cout << i <<" " << cnt+lstpr<<"\n";
		if (lstpr + cnt != totp || flag) continue;
		if (check(i)) {
			//cout <<i <<endl;
			finaa = 1;
			break;
		}
	}
	if (finaa) {
		cout << "Yes\n";
		for (int i = 0;i < m;++i) {
			//printf("p:%d %d %d\n",P[i].typ,P[i].tim,P[i].attpt);
			if (P[i].typ == 1) {
				cout << ".\n"; 
			} else if (P[i].typ == 3) {
				cout << "- " << P[i].attpt <<"\n";
			} else {
				cout << "+ " << P[i].attpt << "/" << P[i].tim <<"\n";
			}
		}
	} else {
		cout <<"No\n";
	}
}

int main() {
	//ios::sync_with_stdio(false);
	int T;cin >> T >> m;	
	while (T--) solve(); 
}
/*
6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100
*/

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

input:

1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

output:

Yes
+ 1/6
+ 3/243
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

result:

ok ok (1 test case)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100

output:

No
No
Yes
- 5
- 6
Yes
+ 1/240
+ 1/240
No
Yes
+ 89/240
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 7ms
memory: 3576kb

input:

1000 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
2 570
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
? 2 5
.
- 2
? 1 3
.
1 140
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
1 195
+ 1/195
.
.
.
.
.
.
.
.
? 1 1
.
.
.
0 0
.
.
.
.
.
.
.
.
.
.
.
.
.
3 776
? 8 22
? 1 8
- 6
+ 1/173
...

output:

Yes
+ 3/183
- 1
+ 9/133
+ 3/278
- 5
+ 3/240
- 5
+ 1/240
- 1
- 5
+ 1/165
- 6
- 2
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 5/251
.
- 2
- 1
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
- 1
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 8
- 1
- 6
+ 1/173
- 11
- 2
- 3
- 6
+ 6/254...

result:

wrong answer 9-th verdict are different from the input. (test case 1)