QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574867#3936. Expecting RainWeaRD276WA 317ms54700kbC++203.4kb2024-09-19 03:52:202024-09-19 03:52:21

Judging History

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

  • [2024-09-19 03:52:21]
  • 评测
  • 测评结果:WA
  • 用时:317ms
  • 内存:54700kb
  • [2024-09-19 03:52:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#include  <ext/pb_ds/assoc_container.hpp>
#include  <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define int ll

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<long long, long long> > vpll;
typedef set<int> si;
typedef set<long long> sll;
typedef map<int, int> mii;
typedef map<long long, long long> mll;

#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

constexpr int INF = 1e9 + 47;
constexpr long long LINF = (ll) 1e18 + 4747;
constexpr int MOD = 998244353;
constexpr int N = 1e5 + 47;

int solve()
{
	int d, t, c, r;
	if (!(cin >> d >> t >> c >> r))
		return 1;
	
	vector<pair<pair<int, bool>, db>> events;
	FOR (i, 0, c)
	{
		int s, e, a;
		db pr;
		cin >> s >> e >> pr >> a;
		events.PB(MP(MP(s, false), a * pr));
		events.PB(MP(MP(e, true), a * pr));
	}
	vector<bool> roof(d + 1);
	FOR (i, 0, r)
	{
		int st, eee;
		cin >> st >> eee;
		FOR (j, st, eee)
			roof[j] = 1;
	}
	
	sort(ALL(events));
	
	vd exp(t + 1);
	int idx = 0;
	db curr = 0;
	FOR (i, 0, t + 1)
	{
		while (idx < SZ(events) && events[idx].F.F == i)
		{
			//cout << "-_-\n";
			if (!events[idx].F.S)
				curr += events[idx].S;
			else
				curr -= events[idx].S;
			idx++;
		}
		//cout << curr << '\n';
		exp[i] = curr;
	}
	vd pexp(t + 2);
	FOR (i, 1, t + 2)
		pexp[i] = pexp[i - 1] + exp[i - 1];
	
	vector dp(d + 1, vd(t + 1, INF));
	FOR (i, 0, t + 1)
		dp[0][i] = 0;
		
	//FOR (i, 0, t + 1)
		//cout << exp[i] << ' ';
	//cout << '\n';
		
	FOR (i, 1, d + 1)
	{
		FOR (j, i, t + 1)
		{
			//cout << roof[i] << '\n';
			if (roof[i])
			{
				dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + exp[j - 1]);
				if (roof[i - 1])
					dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1]);
			}
			else
			{
				dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + exp[j - 1]);
				if (roof[i - 1])
					dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
			}
				
			//cout << "exp = " << exp[j] << '\n';
			//cout << "i = " << i << " j = " << j << " dp = " << dp[i][j] << '\n';
		}
	}
	
	cout << fixed << setprecision(6) << dp[d][t] << '\n';
	
	return 0;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif

    return 0;
}

詳細信息

Test #1:

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

input:

20 60 2 1
5 15 0.33333 30
22 60 0.66666 70
0 10

output:

466.662000

result:

ok found '466.66200', expected '466.66200', error '0.00000'

Test #2:

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

input:

3 4 2 1
1 3 0.25 8
2 4 0.66667 15
1 2

output:

10.000050

result:

ok found '10.00005', expected '10.00005', error '0.00000'

Test #3:

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

input:

3 4 1 0
0 2 0.25 8

output:

2.000000

result:

ok found '2.00000', expected '2.00000', error '0.00000'

Test #4:

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

input:

3 5 2 1
0 3 0.125 32
2 5 0.5 32
3 4

output:

28.000000

result:

ok found '28.00000', expected '28.00000', error '0.00000'

Test #5:

score: 0
Accepted
time: 3ms
memory: 4036kb

input:

26 60 6136 4
0 60 0.547910 73
39 41 0.094359 67
0 60 0.988482 20
0 60 0.242599 33
0 60 0.634549 66
10 20 0.977864 91
32 44 0.568210 81
0 60 0.530795 65
31 45 0.546480 48
42 43 0.130030 83
0 60 0.108433 42
0 60 0.103571 79
8 38 0.891536 33
54 57 0.833739 29
11 58 0.909730 70
0 60 0.858985 2
41 57 0.7...

output:

1338712.212675

result:

ok found '1338712.21268', expected '1338712.21268', error '0.00000'

Test #6:

score: 0
Accepted
time: 3ms
memory: 4040kb

input:

5 60 5946 1
37 52 0.266686 69
0 60 0.723227 36
47 56 0.256874 72
0 60 0.226420 22
0 60 0.988650 80
0 60 0.267332 77
0 60 0.678345 22
0 60 0.974518 76
59 60 0.324089 49
0 60 0.792417 92
0 60 0.930750 44
0 60 0.258607 56
57 59 0.177228 58
57 59 0.182235 65
0 60 0.907016 20
0 60 0.080275 20
53 58 0.983...

output:

165823.407483

result:

ok found '165823.40748', expected '165823.40748', error '0.00000'

Test #7:

score: 0
Accepted
time: 7ms
memory: 4344kb

input:

30 70 14000 1
15 29 0.325545 79
0 70 0.400070 16
0 70 0.145223 38
51 64 0.250562 23
0 70 0.657686 86
0 70 0.849698 60
5 55 0.791354 17
0 70 0.408852 47
32 44 0.512728 20
0 70 0.760533 89
36 47 0.165419 15
0 70 0.262640 5
13 67 0.057902 90
0 70 0.077117 59
0 70 0.726827 21
37 70 0.755209 27
0 70 0.49...

output:

5222979.434567

result:

ok found '5222979.43457', expected '5222979.43457', error '0.00000'

Test #8:

score: 0
Accepted
time: 6ms
memory: 4384kb

input:

17 84 10513 2
0 84 0.076619 58
0 84 0.031737 100
0 84 0.391032 49
0 84 0.124720 80
61 72 0.445021 85
46 70 0.384419 65
0 84 0.784347 2
0 84 0.458732 81
0 84 0.492603 39
0 84 0.737276 36
71 82 0.515552 24
0 84 0.396508 39
0 84 0.740824 96
0 84 0.077276 29
5 33 0.351774 88
14 71 0.880723 48
0 84 0.601...

output:

1597545.787419

result:

ok found '1597545.78742', expected '1597545.78742', error '0.00000'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

17 29 386 2
0 29 0.737740 76
0 29 0.883467 32
0 29 0.669514 89
0 29 0.395894 92
2 13 0.102912 93
25 28 0.881119 98
26 28 0.830786 72
3 6 0.435087 72
0 29 0.878533 58
3 29 0.621739 93
5 15 0.284667 34
9 11 0.035538 88
0 29 0.629487 68
0 29 0.238057 19
6 19 0.478706 88
5 17 0.354688 43
0 29 0.417890 8...

output:

81096.245061

result:

ok found '81096.24506', expected '81096.24506', error '0.00000'

Test #10:

score: 0
Accepted
time: 15ms
memory: 5088kb

input:

70 140 28000 19
25 58 0.653969 31
0 140 0.182857 77
0 140 0.525224 35
28 65 0.639027 46
0 140 0.499527 62
0 140 0.972406 15
96 116 0.270799 67
0 140 0.727482 65
0 140 0.404209 25
0 140 0.627591 41
0 140 0.670551 87
0 140 0.262589 2
0 140 0.471431 96
0 140 0.052116 12
0 140 0.999722 82
0 140 0.169518...

output:

14491930.855773

result:

ok found '14491930.85577', expected '14491930.85577', error '0.00000'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3916kb

input:

159 316 29 26
83 271 0.017059 34
216 301 0.904438 63
0 316 0.306125 38
0 316 0.389166 13
0 316 0.999879 6
0 316 0.422889 75
185 212 0.397764 99
62 224 0.245311 98
0 316 0.892257 68
0 316 0.889513 45
0 316 0.831260 80
209 260 0.516687 48
130 231 0.705673 41
252 304 0.085931 75
0 316 0.265820 49
0 316...

output:

30324.595746

result:

ok found '30324.59575', expected '30324.59575', error '0.00000'

Test #12:

score: 0
Accepted
time: 6ms
memory: 4356kb

input:

65 108 11576 14
0 108 0.451866 89
102 107 0.214761 5
0 108 0.192549 44
0 108 0.578872 45
97 105 0.775360 67
0 108 0.881926 99
59 99 0.882141 22
0 108 0.187132 73
65 69 0.942326 86
48 49 0.762752 25
0 108 0.485119 60
0 108 0.676118 61
59 84 0.670225 21
0 108 0.472056 47
0 108 0.099137 19
99 104 0.646...

output:

7093870.575326

result:

ok found '7093870.57533', expected '7093870.57533', error '0.00000'

Test #13:

score: 0
Accepted
time: 37ms
memory: 10704kb

input:

200 350 70000 9
0 350 0.183884 25
0 350 0.666381 73
222 264 0.386110 94
0 350 0.152467 65
0 350 0.126505 70
162 267 0.680840 29
0 350 0.980514 18
0 350 0.014300 88
0 350 0.738411 45
0 350 0.802286 90
276 306 0.672604 68
0 350 0.116134 60
0 350 0.695887 63
70 336 0.607653 69
54 158 0.131791 21
347 34...

output:

136183967.921956

result:

ok found '136183967.92196', expected '136183967.92195', error '0.00000'

Test #14:

score: 0
Accepted
time: 3ms
memory: 7000kb

input:

325 1323 1703 15
92 1068 0.298625 32
0 1323 0.324423 55
1168 1171 0.470542 75
1297 1303 0.990520 67
426 494 0.276127 81
491 982 0.132386 79
0 1323 0.497464 2
965 1296 0.070819 5
0 1323 0.074802 96
323 700 0.041861 4
636 1261 0.960248 4
0 1323 0.779401 73
0 1323 0.960543 36
1215 1276 0.840067 46
2 61...

output:

5615622.720511

result:

ok found '5615622.72051', expected '5615622.72051', error '0.00000'

Test #15:

score: 0
Accepted
time: 125ms
memory: 19808kb

input:

400 1515 246437 77
1062 1214 0.407384 66
337 738 0.536780 53
0 1515 0.373759 74
1216 1332 0.871290 44
0 1515 0.526030 5
1080 1285 0.911119 96
339 726 0.097646 20
11 756 0.403407 38
0 1515 0.158337 67
0 1515 0.237887 42
0 1515 0.663084 80
0 1515 0.695652 45
0 1515 0.796680 95
0 1515 0.607661 42
351 9...

output:

806602429.426223

result:

ok found '806602429.42622', expected '806602429.42621', error '0.00000'

Test #16:

score: -100
Wrong Answer
time: 317ms
memory: 54700kb

input:

700 3000 600000 216
300 1744 0.660128 36
1032 2131 0.289201 70
2466 2812 0.181266 77
2407 2515 0.598609 69
794 2169 0.526758 20
0 3000 0.682753 49
0 3000 0.321934 95
1140 3000 0.010431 13
2686 2935 0.336705 98
0 3000 0.171854 46
0 3000 0.873140 87
2179 2308 0.875102 29
2612 2826 0.509095 13
587 1875...

output:

1000000047.000000

result:

wrong answer 1st numbers differ - expected: '2720992036.70583', found: '1000000047.00000', error = '0.63249'