QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371846#5140. Frozen ScoreboardDjangle162857WA 287ms3832kbC++143.4kb2024-03-30 17:11:312024-03-30 17:11:31

Judging History

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

  • [2024-03-30 17:11:31]
  • 评测
  • 测评结果:WA
  • 用时:287ms
  • 内存:3832kb
  • [2024-03-30 17:11:31]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
#define debug(x) cerr << #x << " == " << x << endl
#define el '\n'
#define fir first
#define sec second
typedef long long ll;
typedef pair<int, int> PII;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const int N = 200020;
struct problem {
	char typ;
	bool ac;
	int sub, tim;
	int mn, mx;
};
void solve()
{
	int n, m;
	cin >> n >> m;
	while (n--) {
		int totp, tott;
		cin >> totp >> tott;
		char ch;
		vector<problem> t(15), a(15);
		vector<int> f(15);
		int nowtim = 0, nowp = 0;
		for (int i = 1; i <= m; i++) {
			cin >> t[i].typ;
			if (t[i].typ == '.')
				continue;
			if (t[i].typ == '?') {
				cin >> t[i].mn >> t[i].mx;
				t[i].mn = t[i].mx - t[i].mn;
			}
			if (t[i].typ == '-') {
				cin >> t[i].sub;
			}
			if (t[i].typ == '+') {
				cin >> t[i].sub >> ch >> t[i].tim;
				nowtim += (t[i].sub - 1) * 20 + t[i].tim;
				nowp++;
				f[i] = 1;
			}
		}
		// cout << nowtim << endl;
		int resp = totp - nowp, rest = tott - nowtim, fff = 0;
		for (int now = 0; now < (1 << (m + 1)); now++) {
			vector<int> res(15, 0);
			int flag = 0, tt = 0;
			for (int i = 1; i <= m; i++) {
				if (now >> i & 1) {
					res[i] = 1;
					tt++;
				}
			}
			if (tt != totp)
				continue;
			int mnt = 0, mxt = 0, tot = 0;
			for (int i = 1; i <= m; i++) {
				if (res[i] == 1 && f[i] == 1)
					continue;
				if (res[i] == 1 && f[i] == 0) {
					if (t[i].typ != '?') {
						flag = 1;
						break;
					}
					else {
						mnt += 240 + 20 * (t[i].mn);
						mxt += 300 + 20 * (t[i].mx - 1);
						tot += t[i].mx - t[i].mn - 1;
					}
				}
				if (res[i] == 0 && t[i].typ == '+') {
					flag = 1;
					break;
				}
			}

			if (flag == 1)
				continue;
			// cout << mnt << " " << mxt << " " << rest << endl;
			if (mnt <= rest && rest <= mxt) {
				fff = 1;
				// cout << "FIND" << endl;
				int res1 = min(tot, (rest - mnt) / 20);
				int res2 = rest - mnt - res1 * 20;
				// cout << res1 << " " << res2 << endl;
				for (int i = 1; i <= m; i++) {
					if (res[i] == 0) {
						a[i] = t[i];
						if (a[i].typ == '?') {
							a[i].typ = '-';
							a[i].sub = t[i].mx;
						}
					}
					else {
						a[i] = t[i];
						if (a[i].typ == '?') {
							a[i].typ = '+';
							// cout << i << endl;
							int now = a[i].mx - a[i].mn - 1;
							if (res1 >= now) {
								res1 -= now;
								a[i].sub = a[i].mx;
							}
							else {
								a[i].sub = a[i].mn + res1 + 1;
								res1 = 0;
							}
							if (res2 > 0) {
								if (res2 <= 60) {
									a[i].tim = 240 + res2;
									res2 = 0;
								}
								else {
									a[i].tim = 300;
									res2 -= 60;
								}
							}
							else
								a[i].tim = 240;
						}
					}
				}
				break;
			}
		}
		if (fff == 0) {
			cout << "No" << endl;
			continue;
		}
		cout << "Yes" << endl;
		for (int i = 1; i <= m; i++) {
			cout << a[i].typ << " ";
			if (a[i].typ == '.') {
				cout << endl;
				continue;
			}
			if (a[i].typ == '-') {
				cout << a[i].sub << endl;
			}
			if (a[i].typ == '+') {
				cout << a[i].sub << '/' << a[i].tim << endl;
			}
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3832kb

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: 1ms
memory: 3540kb

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: 287ms
memory: 3528kb

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
- 3
- 5
+ 1/165
- 6
- 5
Yes
- 2
- 9
. 
- 1
- 7
- 6
+ 4/179
- 2
+ 5/251
. 
- 2
- 3
. 
Yes
. 
- 2
. 
- 2
- 1
- 2
- 2
. 
. 
. 
. 
+ 3/100
. 
Yes
+ 1/195
. 
. 
. 
. 
. 
. 
. 
. 
- 1
. 
. 
. 
Yes
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
Yes
- 22
- 8
-...

result:

wrong answer submit time should be between 0 and 299 (test case 22)