QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410710#6665. 팀 만들기nguyentunglam0 129ms8660kbC++171.5kb2024-05-14 11:44:072024-05-14 11:44:09

Judging History

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

  • [2024-05-14 11:44:09]
  • 评测
  • 测评结果:0
  • 用时:129ms
  • 内存:8660kb
  • [2024-05-14 11:44:07]
  • 提交

answer

#include<bits/stdc++.h>
#define fi first
#define se second
#define endl "\n"
#define ii pair<int, int>
using namespace std;

vector<long long> build_teams(vector<int> a1, vector<int> b1, vector<int> a2, vector<int> b2,
vector<int> l1, vector<int> r1, vector<int> l2, vector<int> r2) {
  vector<long long> ans(l1.size());

  for(int i = 0; i < l1.size(); i++) {
    auto solve = [&] (auto self, int l, int r, int from, int to) {
      if (l > r) return;
      int mid = l + r >> 1;
      long long best = 0, opt = from;
//      cout << l << "  " << r << " " << from << " " << to << endl;
      for(int j = from; j <= to; j++) {
        long long cost = (a1[mid] + a2[j]) * (b1[mid] + b2[j]);
//        cout << best << " " << cost << endl;
        if (best < cost) {
          best = cost;
          opt = j;
        }
      }
      self(self, l, mid - 1, opt, to);
      self(self, mid + 1, r, from, opt);
//      cout << best << endl;
      ans[i] = max(ans[i], best);
    };
    solve(solve, l1[i], r1[i], l2[i], r2[i]);
//    cout << ans[i] << endl;
  }
  return ans;
}

#ifdef ngu
int main() {

  freopen ("task.inp", "r", stdin);
  freopen ("task.out", "w", stdout);

  vector<long long> ans = build_teams({2, 7, 8, 9, 10}, {10, 9, 8, 6, 1}, {1, 3, 5, 9}, {10, 8, 7, 5}, {0, 2, 1}, {4, 3, 1}, {1, 0, 0}, {3, 2, 0});

  for(auto &j : ans) cout << j << endl;
//  int n; cin >> n;
//
//  vector<int> a1(n), a2(n), b1(n), b2(n);
//
//  int q; cin >> q;

}
#endif // ngu


详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 1ms
memory: 3748kb

input:

500 499
7 4997
13 4988
20 4983
28 4969
44 4963
49 4922
54 4919
58 4897
71 4893
72 4886
85 4883
102 4879
107 4876
113 4868
128 4845
133 4839
135 4831
138 4821
140 4809
156 4793
178 4780
181 4776
190 4760
196 4756
203 4752
209 4736
225 4728
228 4723
232 4720
235 4709
253 4676
258 4660
260 4645
266 463...

output:

25745327
24221652
25260576
25444230
25944610
26027379
25944610
21794500
25502475
19748843
25944610
25269202
25294500
24084151
25944610
25944610
25923420
25745327
24097815
21842574

result:

ok 20 lines

Test #2:

score: 5
Accepted
time: 1ms
memory: 3776kb

input:

500 499
3 4994
6 4989
12 4978
20 4972
22 4965
32 4949
48 4914
52 4893
56 4875
62 4867
66 4860
80 4840
98 4828
106 4814
108 4788
127 4785
142 4783
177 4775
181 4770
182 4766
191 4764
201 4757
205 4753
235 4743
298 4740
300 4725
326 4720
346 4714
350 4709
373 4703
379 4680
390 4674
391 4643
393 4640
3...

output:

22404249
24625440
24983847
24994621
26178282
25385964
25028495
18972628
24778368
24808000
25212965
24604640
23302608
24979302
22241460
25385964
24155109
26178282
25137864
25619090

result:

ok 20 lines

Test #3:

score: 5
Accepted
time: 1ms
memory: 3748kb

input:

500 499
3 4988
4 4967
8 4953
10 4942
11 4936
13 4930
20 4927
40 4904
43 4897
61 4892
65 4852
70 4849
74 4815
78 4812
90 4801
91 4792
107 4783
116 4781
121 4770
123 4747
125 4738
129 4706
132 4700
134 4698
139 4684
145 4680
148 4667
155 4665
164 4652
181 4651
188 4649
191 4648
199 4646
202 4628
209 4...

output:

25458244
17507070
23722057
23685867
24493896
26156980
21925946
26222616
25564880
25172184
24611064
17491437
25418853
25931580
25669456
25144644
26156980
25931580
17224980
25581918

result:

ok 20 lines

Test #4:

score: 5
Accepted
time: 4ms
memory: 3776kb

input:

500 499
22 5000
23 4994
33 4971
34 4960
35 4949
36 4943
37 4930
66 4891
112 4879
118 4863
132 4859
136 4854
152 4851
153 4848
154 4845
164 4842
180 4814
184 4801
197 4798
211 4794
214 4789
221 4773
226 4770
250 4768
256 4760
265 4728
267 4727
272 4718
288 4693
313 4691
318 4683
340 4676
352 4662
355...

output:

25267216
25648854
24950190
25648854
25648854
25192470
25648854
25267216
25267216
25022088
25648854
25267216
24968784
24378216
25648854
25840997
25648854
25648854
25648854
25822235
25648854
24947710
25822235
25822235
25822235
25267216
25648854
25022088
25509360
25840997
25648854
25648854
25648854
252...

result:

ok 500 lines

Test #5:

score: 5
Accepted
time: 4ms
memory: 3748kb

input:

500 499
4 4995
10 4970
25 4967
29 4960
32 4958
39 4954
44 4937
45 4930
52 4927
64 4912
66 4910
67 4901
69 4897
71 4875
79 4863
81 4852
82 4831
89 4816
98 4805
106 4800
116 4794
121 4785
136 4765
137 4756
144 4743
156 4736
157 4724
159 4721
160 4720
163 4715
166 4707
180 4704
185 4701
197 4697
224 46...

output:

26806923
25439158
26931420
26192385
26651388
26651388
25061382
26931420
26453167
25395564
26931420
26453167
26931420
26453167
26931420
26513175
26931420
26453167
26603521
26931420
26453167
26931420
26263972
26931420
26931420
26453167
26931420
26192385
26931420
26931420
26931420
26931420
26931420
269...

result:

ok 500 lines

Test #6:

score: 5
Accepted
time: 0ms
memory: 3956kb

input:

5 5
1 10
2 7
5 6
6 5
10 4
3 10
5 9
6 8
8 3
9 1
5
1 2 0 0
3 4 3 3
0 1 0 0
0 0 3 3
2 3 2 2

output:

128
126
85
117
156

result:

ok 5 lines

Test #7:

score: 5
Accepted
time: 0ms
memory: 3728kb

input:

5 5
2 8
3 5
4 4
7 3
9 1
1 10
2 9
3 3
5 2
10 1
5
0 4 3 3
2 4 0 0
2 3 2 2
2 2 0 0
1 4 1 1

output:

70
110
60
70
110

result:

ok 5 lines

Test #8:

score: 5
Accepted
time: 1ms
memory: 3748kb

input:

500 499
9 4994
14 4980
28 4978
29 4952
34 4940
62 4930
70 4917
74 4910
82 4901
106 4890
107 4883
110 4872
113 4871
119 4857
128 4853
131 4848
140 4839
144 4828
148 4816
153 4796
156 4786
159 4781
168 4770
181 4730
188 4727
193 4722
194 4721
215 4708
217 4707
232 4691
245 4690
258 4680
260 4667
261 4...

output:

20531749
16972104
21053425
23103696
25098804
25340760
25341680
21832928
21858600
25179924
23973411
21140084
21751158
14683410
23024292
14844505
25260348
18876924
24160328
21938755
24261405
24268965
23674320
23894930
22236925
24992050
5970151
20907068
23901372
24515392
24392200
21902265
24623903
2158...

result:

ok 500 lines

Test #9:

score: 5
Accepted
time: 1ms
memory: 4008kb

input:

500 499
5 4995
36 4981
46 4980
57 4979
71 4978
73 4972
76 4971
78 4959
79 4943
88 4923
95 4913
104 4908
113 4905
126 4897
129 4885
130 4874
173 4857
175 4825
178 4807
184 4804
187 4800
199 4784
202 4773
245 4772
250 4767
251 4766
281 4725
286 4720
287 4699
347 4698
349 4696
362 4693
372 4687
376 468...

output:

24953172
24794000
25335478
24556337
24128202
21977650
20408654
24631050
24409540
23185940
24632584
24312130
23457312
18707214
24737080
24174850
21375835
24631050
24378705
24621552
24900019
20720233
25734498
24871728
23796768
15357936
18732816
24483622
25789992
25660096
25742340
22546506
22812636
242...

result:

ok 500 lines

Test #10:

score: 5
Accepted
time: 1ms
memory: 3700kb

input:

4 2
1 9
6 5
8 3
10 1
5 8
6 7
4
0 0 0 1
1 1 0 1
2 2 0 1
3 3 0 1

output:

112
144
143
135

result:

ok 4 lines

Test #11:

score: 5
Accepted
time: 0ms
memory: 3972kb

input:

5 4
2 10
7 9
8 8
9 6
10 1
1 10
3 8
5 7
9 5
4
0 4 1 3
2 3 0 2
1 1 0 0
1 1 1 1

output:

224
195
152
170

result:

ok 4 lines

Test #12:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

1 1
9 5
4 7
1
0 0 0 0

output:

156

result:

ok single line: '156'

Test #13:

score: 5
Accepted
time: 0ms
memory: 3952kb

input:

2 2
3 10
6 2
4 7
6 2
10
0 1 0 0
1 1 0 0
0 0 0 0
0 1 0 1
0 1 0 0
0 1 0 0
1 1 1 1
1 1 1 1
0 1 1 1
0 1 0 0

output:

119
90
119
119
119
119
48
48
108
119

result:

ok 10 lines

Test #14:

score: 5
Accepted
time: 0ms
memory: 3740kb

input:

3 3
1 14
3 8
11 3
1 9
10 8
12 5
10
0 0 0 0
2 2 0 2
0 0 0 2
0 2 1 1
1 2 0 1
0 1 1 1
1 1 2 2
1 2 1 2
0 2 0 0
0 0 1 2

output:

46
231
247
242
231
242
195
231
144
247

result:

ok 10 lines

Test #15:

score: 5
Accepted
time: 0ms
memory: 3748kb

input:

5 5
4 19
10 14
15 11
17 3
19 2
2 19
10 7
14 3
15 2
17 1
10
3 4 2 3
0 1 2 3
3 3 1 1
1 4 0 3
3 4 3 3
4 4 3 4
3 4 3 4
0 3 3 4
2 3 0 3
3 3 0 3

output:

186
408
270
510
160
136
160
420
510
418

result:

ok 10 lines

Test #16:

score: 5
Accepted
time: 0ms
memory: 3740kb

input:

7 7
2 19
4 13
5 10
6 6
7 5
10 4
12 3
2 20
6 15
8 12
11 9
14 7
15 6
17 1
10
0 4 0 3
2 3 2 5
2 3 1 3
5 5 2 5
3 5 4 5
1 6 3 4
2 4 2 5
2 6 0 5
1 5 0 1
1 6 0 4

output:

364
323
304
288
264
360
323
324
304
360

result:

ok 10 lines

Test #17:

score: 5
Accepted
time: 0ms
memory: 3728kb

input:

10 10
3 19
5 18
8 17
10 13
12 10
13 9
15 8
16 6
17 5
18 1
1 19
6 15
7 14
9 13
10 12
13 10
14 7
16 5
17 2
18 1
10
0 1 5 5
5 6 0 6
0 5 1 7
5 8 3 7
3 5 1 8
3 5 0 7
0 4 8 8
6 7 0 2
3 4 1 7
6 9 1 7

output:

504
504
567
504
529
529
475
484
529
504

result:

ok 10 lines

Test #18:

score: 5
Accepted
time: 0ms
memory: 3972kb

input:

15 15
2 20
3 19
4 18
5 17
6 16
8 15
9 14
10 12
11 11
12 9
13 7
14 6
15 5
16 3
20 1
1 20
2 19
3 17
4 15
5 14
6 13
7 12
11 11
13 8
14 6
15 5
16 4
17 3
18 2
19 1
10
2 8 2 8
8 12 7 13
2 7 2 3
1 10 1 14
0 13 10 13
1 10 8 12
6 13 3 14
13 14 7 13
5 10 1 3
2 14 2 5

output:

500
484
378
500
460
484
500
378
392
414

result:

ok 10 lines

Test #19:

score: 5
Accepted
time: 2ms
memory: 3776kb

input:

498 499
27 4991
37 4989
49 4978
54 4967
65 4964
70 4963
76 4943
77 4935
110 4903
112 4883
116 4882
118 4871
123 4870
126 4868
130 4860
136 4855
139 4840
146 4817
159 4816
203 4811
235 4810
249 4806
257 4798
259 4795
272 4786
283 4783
288 4781
289 4771
301 4764
302 4745
333 4730
335 4719
345 4713
350...

output:

25059100
26443626
24701330
25664187
24972456
26443626
23704800
24849946
24730376
24024673
25410691
25196431
25882857
20204998
26443626
17370044
26443626
26443626
23404703
25209247
24488802
24843336
25441668
24956295
25078491
25664187
20478964
25459972
25145413
23747913
25078491
25910042
25051490
223...

result:

ok 500 lines

Test #20:

score: 5
Accepted
time: 2ms
memory: 3764kb

input:

423 400
2 4968
60 4946
72 4938
91 4910
95 4899
98 4869
110 4832
116 4827
119 4804
121 4797
122 4795
124 4782
129 4776
131 4774
151 4763
162 4745
163 4722
182 4713
196 4683
200 4679
207 4676
210 4664
223 4621
249 4619
265 4617
275 4615
281 4612
293 4598
301 4597
333 4578
343 4557
346 4547
380 4529
39...

output:

25653405
26650000
6823686
26446696
16542394
25074350
22265488
27134380
26779122
27260832
25686258
23517530
23330238
23661300
22902808
27134380
24632011
25848669
20042100
24981181
26779122
26560890
20610852
25638726
27260832
25973892
26571468
24161598
27167912
26286516
27167912
26944533
25444281
2648...

result:

ok 500 lines

Test #21:

score: 5
Accepted
time: 2ms
memory: 3768kb

input:

500 500
12 4998
18 4994
32 4990
55 4970
57 4961
74 4950
91 4939
96 4937
122 4931
124 4921
127 4881
130 4877
138 4857
159 4846
160 4844
165 4843
166 4836
181 4831
199 4818
212 4809
253 4786
254 4783
272 4755
273 4739
275 4736
298 4734
307 4733
318 4728
321 4719
322 4714
351 4686
353 4681
357 4678
366...

output:

24251001
24408876
25954800
23803350
25912414
24408876
25731552
20675986
25879501
25464547
23738916
25492509
25954800
23163164
24524286
25005420
24258960
19881316
23864274
24884695
25492509
25119900
25452315
24408876
24900444
24991520
24533130
25492509
24649056
24041177
25141164
25194085
25954800
233...

result:

ok 500 lines

Test #22:

score: 0
Wrong Answer
time: 0ms
memory: 3768kb

input:

499 500
241 1998397
2131 1996036
3317 1995104
8667 1992186
10801 1984868
14767 1982136
18355 1981825
18693 1978196
23272 1974799
28185 1974598
29185 1958817
31885 1951969
32657 1949913
36165 1943326
46509 1933617
47554 1932321
48342 1926639
49847 1923024
52698 1920254
55874 1918534
56057 1909221
568...

output:

2127600414
2146635178
2142098735
2145611688
2145609031
2146142412
2145399056
2145609768
2146636426
2127222055
2139292692
2140688513
2147123379
2145941404
2146114956
2146317890
2146226194
2142496834
2144946740
2126173744
2142124024
2147187278
2144520112
2142698192
2146988316
2144775296
2144807244
214...

result:

wrong answer 1st lines differ - expected: '2543777519646', found: '2127600414'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Time Limit Exceeded

Test #47:

score: 0
Time Limit Exceeded

input:

200 100000
335635 996427627
4368692 990235584
10335314 971208588
11639195 971143844
23801483 970115479
31489602 959110431
31544396 956821351
48348198 954187112
48509739 953684848
51173262 952420589
53207608 941523603
62582103 940608015
65545228 932323862
73708623 932037283
80559453 929148992
9033280...

output:

Unauthorized output

result:


Subtask #4:

score: 0
Wrong Answer

Test #65:

score: 0
Wrong Answer
time: 129ms
memory: 8660kb

input:

200 100000
2904660 993940483
16886371 993289642
17317405 990982034
18403947 976774733
18849359 973351068
19183185 970254940
19306003 966229683
21192298 964806508
23734314 964320708
23888967 955733824
27113148 951453312
37031360 944529530
39266197 937051115
40090929 928931574
59651306 922916360
69712...

output:

2099728668
2093054548
2003674851
2097779124
2128036368
2027155848
2137306762
2067393343
2137448548
681815094
2109837344
2142155107
1965968454
2083141934
2103286248
2114218832
2106681964
2086361206
1562228624
2028656800
2100366686
1982190974
2117069453
2121648269
2139302768
2144292922
2043338580
2136...

result:

wrong answer 1st lines differ - expected: '1016308928382908236', found: '2099728668'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%