Rank Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
11801 1882 17
11802 1881 2
11803
Ngocminhphan
Phan Ngọc Minh
1881 7
11804 1880 5
11805
nhatminh2816 1012
Đặng Vũ Nhật Minh
1880 3
11806 1880 13
11807 1879 17
11807 1879 17
11807 1879 17
11807
tkanhdinhquoc
Đinh Quốc Anh - LDO
1879 17
11807 1879 17
11807 1879 17
11807 1879 17
11807
PY1ENguyenTanThanh
Nguyễn Tấn Thành
1879 17
11807
vinh1372004
Duong Vinh
1879 17
11807 1879 17
11807 1879 17
11807 1879 17
11807 1879 17
11807 1879 17
11807
codepython15
Trần Khải Lâm
1879 17

Để thắng cuộc, bạn cần cả kỹ năng và ý chí. – Frank Tyger!

11807 1879 17
11807
Hoxuanhung2802
Hồ Xuân Hùng
1879 17
11807
dzcojsai1234
Dũng Trầnnn
1879 17
11807 1879 17

‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌

11826 1878 15
11827 1878 6
11828 1878 5
11829 1877 5
11830 1877 6
11831 1876 7
11832
Lê_Phước_Thắng
Lê_Phước_Thắng_LớpA1
1876 49
11833 1875 4
11834 1874 4
11834 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;
}

11836 1872 15
11837 1872 19
11838 1872 3

11839 1872 15
11840 1870 11
11841 1870 16
11842 1870 7
11843 1870 13
11843
STRB03Triet
Phan Đình Triết
1867 10
11845 1866 3

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import random

def is_prime(n, k=5):
if n <= 1:
return False
if n == 2 or n == 3:
return True
if n % 2 == 0:
return False

for i in range(k):
    a = random.randint(2, n-1)
    if pow(a, n-1, n) != 1:
        return False

return True
11846 1866 8
11847 1865 6
11848 1865 8
11849 1865 7
11850 1863 3
11851 1862 2
11852 1862 2
11853
NHU42 1397
Bùi Hữu Nhật Minh
1861 4

Always be yourself, express yourself, have faith in yourself, and do not go out and look for a successful personality and duplicate it.

11854 1861 3
11855 1861 9
11856 1861 2
11857 1860 11
11858 1860 4
11859
thongvinh2
Phan Điền Vĩnh Thông
1860 13
11860 1859 13
11861 1859 17
11862 1858 12
11863 1857 11
11864
NguyenHuuTin20a3
Nguyễn Hữu Tín
1857 2
11864 1857 2
11864 1857 2
11867 1857 4
11868 1857 8
11869 1856 19
11870 1856 3
11871 1854 2
11872 1853 3
11872 1853 3
11872 1853 3
11872 1853 3

bruh

11872 1853 3
11877 1852 11
11878 1852 5
11879 1851 2
11880 1850 9
11881 1850 4
11882 1849 15
11883 1849 6
11884 1848 17
11885
vohuutan142
Võ Hữu Tân|VK17
1848 47
11886 1848 16
11887 1848 5
11888 1847 17
11889 1846 14
11890 1846 6
11891
tram0337048498
Nguyen Thi Nhu Tram
1845 14

HELLO

11892 1844 17
11893 1844 4
11894 1844 12
11895 1844 5
11896 1843 2
11897
Mikek 1441
1843 3
11898 1842 3
11899 1842 4
11900 1842 5