QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#485585#1140. Distributing CandiesRafi223 2011ms11672kbC++201.3kb2024-07-20 20:25:572024-07-20 20:25:57

Judging History

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

  • [2024-07-20 20:25:57]
  • 评测
  • 测评结果:3
  • 用时:2011ms
  • 内存:11672kb
  • [2024-07-20 20:25:57]
  • 提交

answer

#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

const int N=200007;

vector<int>distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v)
{
	int n=sz(c),q=sz(l);
	vector<int>ans(n);
	FOR(i,0,n-1)
	{
		vector<ll>V={0};
		FOR(j,0,q-1) if(i>=l[j]&&i<=r[j]) V.pb(V.back()+(ll)v[j]);
		reverse(all(V));
		ll mn=infl,mx=-infl;
		ans[i]=-1;
		for(auto x:V)
		{
			mn=min(mn,x);
			mx=max(mx,x);
			if(mx-mn>c[i])
			{
				if(x==mn) ans[i]=V[0]-(mx-(ll)c[i]);
				else ans[i]=V[0]-mn;
				break;
			}
		}
		if(ans[i]==-1) ans[i]=V[0]-mn;
	}
	return ans;
}

详细

Subtask #1:

score: 3
Accepted

Test #1:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
8
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
8
0 7 1
0 7 1
0 7 300000000
0 7 994967293
0 7 1
0 7 1000000000
0 7 1000000000
0 7 1000000000

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

result:

ok 3 lines

Test #2:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
283 43634 101056 10340 6009 5133 30 2 3677888 210
10
1 8 26416
2 7 -51219
2 4 17793
3 7 75426
3 7 22307
1 1 60258
3 7 -29824
0 8 24839
2 8 -60304
0 1 -26411

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 17223 0 0 0 0 0 0 0 0

result:

ok 3 lines

Test #3:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
5895610 429664 3124 17993 758457 101345 5102817 1127952 59 81146
2000
6 7 44356
5 7 77812
1 4 -41353
1 7 -81697
2 5 -26607
4 9 84461
4 7 -44947
1 6 42622
3 5 -99951
0 1 -77687
2 6 52280
5 9 5073
1 9 67601
6 8 -6669
0 6 42368
4 6 22221
1 3 48306
3 6 -23492
...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1520966 0 0 0 20922 69708 15240 91107 0 78774

result:

ok 3 lines

Test #4:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
100
1281 616650 26929 344 1231 263 183010 1 1 46 144770 17 1735 9520 7 1 39535 8307 2 5 32940 498570 644480 10107 1645 21 443708 4 28177 2857127 2 1 1350 17506 5 36 1985 42978 24123 73 114 230034 5561405 11263 9754875 4671 44 3 8982 299 452 15 2619 9 7 6259 8...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 19101 26929 344 1231 263 14968 1 1 46 40142 17 1735 9520 7 1 31323 8307 2 5 16804 87522 84360 5468 1645 21 93788 4 28177 158016 2 1 1350 17506 5 36 1985 42978 24123 73 114 230034 248401 11263 290026 4671 44 3 8982 299 452 15 2619 9 7 6259 68282 104034 17...

result:

ok 3 lines

Test #5:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
30 43135 3633 8815565 7 10656 4747283 11 1955823 368399 1933641 1354338 121930 8151786 1 2 8 3693091 433 39590 3210647 4211 49 288876 9195 37 129470 1370232 65473 2 10572 49 15282 452 8700630 9946 17 3 39005 1040244 167569 37 2 24552 115 7 117 350655 198...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
30 43135 3633 342743 7 10656 352396 11 498344 368399 425526 434636 121930 524601 1 2 8 427431 433 39590 398492 4211 49 288876 9195 37 129470 481647 65473 2 10572 49 15282 452 865424 9946 17 3 39005 791920 135995 37 2 24552 115 7 117 319081 1988 18 846056 7...

result:

ok 3 lines

Subtask #2:

score: 0
Time Limit Exceeded

Test #6:

score: 0
Time Limit Exceeded

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

Unauthorized output

result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #9:

score: 27
Accepted
time: 1ms
memory: 3852kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #10:

score: 0
Accepted
time: 2011ms
memory: 9784kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1049802 936230 884511 204101 406074 550834 961642 2076245 1975297 2101513 2254310 1990108 1398298 1917785 2864344 2475931 2270774 401698970 402327667 402506418 401068637 399388438 398687119 398672863 397137012 397262070 396255448 395961553 394643443 394646...

result:

ok 3 lines

Test #11:

score: 0
Accepted
time: 580ms
memory: 5920kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #12:

score: -27
Time Limit Exceeded

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

Unauthorized output

result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #16:

score: 29
Accepted
time: 0ms
memory: 3796kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
11 440 51 41 11 1 3 108 148 14
10
0 9 60
0 9 -9
0 9 -30
0 9 41
0 9 82
0 9 69
0 9 -79
0 9 -39
0 9 72
0 9 41

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11 208 51 41 11 1 3 108 143 14

result:

ok 3 lines

Test #17:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
6 129 1 3 18 414 46 7 33 2 29 3 395 143 120 62 343 102 568 40 49 1 37 7 31 66 12 1 330 4 3 10 3 216 2 375 15 786 1 156 243 411 519 14 13 13 667 2 382 294 1 556 53 2 368 1 32 5 201 13 376 369 91 11 14 5 584 65 3 443 1 989 889 22 8 177 140 7 481 6 371 142 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 68 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #18:

score: 0
Accepted
time: 1428ms
memory: 11672kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
4207825 17466917 11 20 10489 1278831 48720 43780703 37223309 28500011 76204785 631 321 1650 263304936 1382 1900 1 225756109 43424483 21143 218062355 851196097 633450 141629084 11494 1 19 12133 5908567 7 26138 1131 152662321 18 787906 312 11463 393 109417...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
780706 1955314 11 20 10489 659178 48720 1955314 1955314 1955314 1955314 631 321 1650 1955314 1382 1900 1 1955314 1955314 21143 1955314 1955314 633450 1955314 11494 1 19 12133 1691591 7 26138 1131 1955314 18 659178 312 11463 393 659178 659178 1180 1955314 5...

result:

ok 3 lines

Test #19:

score: 0
Accepted
time: 1015ms
memory: 5964kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
401 38224076 293 9 2873526 11 356842329 318925257 728 169 749704686 13312846 8 6106116 4 379784 2 678669 1104 1268657 4579072 4620407 111763 117481111 81224 415449128 69269056 62353747 592 998 1135181 7443857 5706444 6 2 11 87555 3780941 72 8 407 11455...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 2136442 0 0 1590745 0 2136442 2136442 0 0 2136442 2136442 0 2136442 0 120361 0 120361 0 120361 2136442 2136442 24468 2136442 0 2136442 2136442 2136442 0 0 120361 2136442 2136442 0 0 0 260 2136442 0 0 0 0 2136442 0 0 0 1210287 2136442 2136442 0 2136442 0 ...

result:

ok 3 lines

Test #20:

score: -29
Time Limit Exceeded

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
2 607917 87 7743038 272 19678 1 98 439 30 7898 262 2631381 23073 1026097 3698 6614 40 442324 168 3 43717 2370 1627514 8316081 398 1882901 1 42496 1 20135 29167 4032 6305 3894321 170 598 492 9418417 74322 2401853 52 42 31 145771 1720 63583 100 270 4249 ...

output:

Unauthorized output

result:


Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%