Tên đăng nhập Điểm Bài tập ▴ Giới thiệu
19801 410 3
19802 858 3
19803 288 3
19804 866 3
19805 1873 3

include <iostream>

include <math.h>

include <algorithm>

include <climits>

include <queue>

include <vector>

include <stack>

include <string>

include <iomanip>

include <tuple>

include <set>

include <map>

using namespace std;

define int long long

const int MAXN = 300005;
int a[MAXN];
int s;
int n;

void solve(){
cin >> n >> s;
for(int i = 1 ; i <= n ;i++){
cin >> a[i];
}
int i = 1;
int j = n ;
while(i <= j){
if(a[i] + a[j] < s){
i++;
}else if(a[i] + a[j] > s){
j--;
}else if(a[i]+a[j] == s){
cout << i << " " << j << endl;
return;
}
}
cout << "No solution" << endl;
return;

}

signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t=1;
// cin >> t;
while(t--){
solve();
}
return 0;
}

19806 288 3
19807 720 3
19808 601 3
19809 988 3
19810 288 3
19810 288 3
19812 335 3
19813
NHU32
Hồ Khánh Đan
4396 3
19814
NHU41
Trần Bình Nguyên
397 3
19815 274 3
19816 811 3
19817 809 3
19818 2738 3
19819
phungdinhtuansn04052008
Phùng Đình Tuấn
1732 3
19820 145 3
19821 1188 3
19822 988 3
19822 988 3
19822 988 3
19825 288 3
19826
Articulation_po
Articulation_points
2785 3
19827 988 3
19828 288 3
19829 988 3
19830 288 3
19831 1674 3
19832 288 3
19832 288 3
19832 288 3
19832 288 3
19836 1441 3
19837 522 3
19838 688 3
19839 740 3
19840 206 3
19841 351 3
19842 288 3
19843 590 3
19844 2353 3
19845 4033 3
19846 583 3
19847 988 3

moai

19848
killerboy2866
Nguyễn Đình Văn Cương
817 3
19849 130 3
19850 288 3
19851
24BSTR17
Nguyễn Đức Hiếu
243 3
19852 1054 3
19853 1697 3
19854 2836 3
19855 104 3
19856 808 3
19857 388 3
19858 288 3
19858 288 3
19860 532 3
19861
ICT24A00112
Nguyễn Ngọc Minh Khang
1038 3
19862
ICT24A00118
Lê Trần Ngân Khánh
895 3
19863
ICT24A00120
Phan Công Khoa
2191 3
19864
ICT24A00218
Hồ Tấn Phúc
288 3
19865
ICT24B00402
Nguyễn Văn Gia Bảo
388 3
19866
ICT24B00414
Trần Văn Hoàng Sơn
1054 3
19867 858 3
19868 285 3
19869 210 3
19870 4235 3
19871
Mary 679
1044 3
19872 1469 3
19873 530 3
19874 510 3
19875 673 3
19876 488 3
19877 289 3
19878
RMQ 1315
242 3
19879 1019 3
19880 3484 3
19881 388 3
19882 4476 3
19883 1088 3

mat acc douzxje

19884 209 3
19885 288 3
19885 288 3
19887 233 3
19888 260 3
19889 343 3
19890
Min_Hiz2k7
Nguyễn Văn Nghĩa
444 3
19891
datnltfhh30295
Nguyễn Lê Tuấn Đạt
1188 3
19892 2622 3
19893 219 3
19894 483 3
19895 251 3
19895 251 3
19897 1653 3
19898 1921 3
19899 288 3
19900 1678 3