#include <iostream> #include <algorithm> using namespace std; long long a[2001010]; int main(){ ios_base::sync_with_stdio(0); long long pot,ilo,raz,on=0,tw,ma,io=2; cin>>ilo>>pot; tw=0; raz=(ilo*(ilo+1))/2; for (long long i=0;i<raz;i++) { cin>>a[i]; } if(pot%2==1)pot++; while(tw<pot){on++; tw=tw+on; } tw=(on*(on+1))/2; sort(a,a+tw); ma=a[0]; cout<<ma; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <iostream> #include <algorithm> using namespace std; long long a[2001010]; int main(){ ios_base::sync_with_stdio(0); long long pot,ilo,raz,on=0,tw,ma,io=2; cin>>ilo>>pot; tw=0; raz=(ilo*(ilo+1))/2; for (long long i=0;i<raz;i++) { cin>>a[i]; } if(pot%2==1)pot++; while(tw<pot){on++; tw=tw+on; } tw=(on*(on+1))/2; sort(a,a+tw); ma=a[0]; cout<<ma; return 0; } |