ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#198958 | #3463. 最大区间 | baiencheng | 100 | 4162ms | 24700kb | C++11 | 740b | 2023-12-03 11:08:25 | 2023-12-03 12:17:07 |
answer
#include<bits/stdc++.h>
#include<ctime>
#define int long long
#define itn int
#define ull unsigned long long
#define ll long long
using namespace std;
int n,k;
int a[1000005];
priority_queue<pair<int,int> > qj;//区间权值 区间左端点(固定) 区间右端点(不固定)
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
qj.push(make_pair(a[i],i));
}
for(int i=1;i<=k;i++){
cout<<qj.top().first<<"\n";
auto p=qj.top();
qj.pop();
if(p.second!=n){
qj.push(make_pair(__gcd(p.first,a[p.second+1]),p.second+1));
}
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 67ms
memory: 1300kb
input:
1000 500500 316229930 195440845 285 190 173850 107445 48194844915 29786052240 3470662866825 21449876...
output:
26383670221365600 16306004944772400 8332780503682635 7971077017640880 7253015614619775 5149941572068...
result:
ok 500500 lines
Test #2:
score: 10
Accepted
time: 117ms
memory: 1300kb
input:
1000 500500 10 5 45 30 3705 2280 452880675 279895650 18411000 11378625 13430625 8300625 6940498125 4...
output:
13694362219137600 12805411076655120 12463020406156320 8463581305679500 7914179285287275 770257021348...
result:
ok 500500 lines
Test #3:
score: 10
Accepted
time: 65ms
memory: 1304kb
input:
1000 500500 2571145 1589055 7945275 4910450 3557450 2198625 75348000 46567625 4922125 3042000 940062...
output:
36372051035345025 22479163780389030 13119152823571600 10459936245458700 8108082348571400 74488088766...
result:
ok 500500 lines
Test #4:
score: 10
Accepted
time: 328ms
memory: 3672kb
input:
100000 1000000 269019726702209411 974764215496813081 547920080673102149 403277729561219907 575984909...
output:
999997745191855356 999963005393234573 999926113482756345 999922932458629212 999873551825672168 99986...
result:
ok 1000000 lines
Test #5:
score: 10
Accepted
time: 417ms
memory: 3676kb
input:
100000 1000000 269845965585325539 410993175365329221 287854792412106895 411389931291882089 384766635...
output:
999984587617809411 999982422426861182 999977862966742257 999962389243327312 999960196509914341 99995...
result:
ok 1000000 lines
Test #6:
score: 10
Accepted
time: 291ms
memory: 3672kb
input:
100000 1000000 270672213058376259 847222126643910770 251161541005887448 196130104757703054 970176324...
output:
999969088094752736 999950043867991957 999942757941147478 999938229401659037 999937972040991874 99993...
result:
ok 1000000 lines
Test #7:
score: 10
Accepted
time: 857ms
memory: 24700kb
input:
1000000 1000000 445 275 2160 1335 9345 5775 1969065 1216950 2742977370 1695253245 1295058240 8003900...
output:
975897643491928749 967909511887184303 957662363896634201 937776145086931820 935483120267844976 93449...
result:
ok 1000000 lines
Test #8:
score: 10
Accepted
time: 681ms
memory: 24700kb
input:
1000000 1000000 120789085 74651760 373258800 230686625 3751250 2318400 437094650 270139350 72250 433...
output:
989440590200479888 979442127462649963 962123363113843633 949234663940571975 922027929185254986 91132...
result:
ok 1000000 lines
Test #9:
score: 10
Accepted
time: 655ms
memory: 24700kb
input:
1000000 1000000 511670775 316229930 275 165 1493195 922845 24310 12155 3843774799150 2375583470975 4...
output:
993470386599911223 982929594264450702 981834284237042557 980913038932188165 977556796318907338 96567...
result:
ok 1000000 lines
Test #10:
score: 10
Accepted
time: 684ms
memory: 24696kb
input:
1000000 1000000 4131543 2553434 22615848255 13977362906 63648 39338 26483679092 16367813826 766428 4...
output:
996943230476562837 992744165900993793 977870523681018327 973905575456964502 971181334873983918 94411...
result:
ok 1000000 lines
Extra Test:
score: 0
Extra Test Passed