Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
25301
kevingamin1707
Trần Trung Kiên
201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1

include<bits/stdc++.h>

using namespace std;

using ll = long long;

const int LIM = 1e6 + 16;
int a[LIM];
int main(){

int n, x; cin >> n >> x;
for(int i = 1; i <= n; i++){
    cin >> a[i];
}
for(int l = 1, r = n; l < r; l++){
    while(l < r - 1 && a[l] + a[r] > x) --r;
    if(a[l] + a[r] == x){
        cout << l << " " << r;
        return 0;
    }
}
cout << "No solusion";
return 0;

}

25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1

include <bits/stdc++.h>

using namespace std;

define int long long

define task "str"

const int M = 1e9 + 7;

void file() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
}

bool cmp(string a, string b) {
return a.size() < b.size();
}

signed main(){
//file();
string s; cin >> s;
map<char, int> mp;
vector<string> v, v1;
string cnt = "";
for (int i = 0; i < s.size(); i++){
if (islower(s[i])) mp[s[i]]++;
if (isdigit(s[i])) {
cnt += s[i];
v.push_back(cnt);
}
else cnt = "";
}
if (cnt != "") v.push_back(cnt);
for (int i = 0; i < v.size(); i++) {
reverse(v[i].begin(), v[i].end());
for (int j = v[i].size() - 1; j >= 1; j--) {
if (v[i][j] == '0') v[i].pop_back();
else break;
}
reverse(v[i].begin(), v[i].end());
}

sort(v.begin(), v.end(), cmp);
int res = v[v.size() - 1].size();
for (int i = 0; i < v.size(); i++) if (v[i].size() == res) v1.push_back(v[i]);
sort(v1.begin(), v1.end());
cout <<v1[v1.size() - 1];
return 0;

}

25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1

include <bits/stdc++.h>

define ll long long

define name "DOLLS"

define N 100004

using namespace std;
int n,k,j=1,x=1;
int a[N];
ll ans=0;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
/if(fopen(name".INP","r"))
{
freopen(name".INP","r",stdin);
freopen(name".OUT","w",stdout);
}
/
cin >> n >> k;
for(int i=1;i<=n;i++) cin >> a[i];
sort(a+1,a+n+1,greater<int>());
for(int i=1;i<=n;i++)
{
if(a[i] > 0)
{
ans += a[i];
j = i;
x = a[i];
while(j<=n)
{
j++;
if(a[j] + k <= x && a[j] > 0)
{
x = a[j];
a[j] = 0;
}
}
}
}
cout << ans;
return 0;
}

25301 201 1
25301 201 1
25301 201 1
25301
letrungdangkhoahvt
Lê trung Đăng Khoa
201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1
25301 201 1

helloo

25301 201 1
25301 201 1
25353 200 3
25353 200 3
25353 200 3
25356 200 4
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357
Dainn98
Tuan Anh
200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25357 200 1
25395
mttn058nc
NC DL Do Gia Huy
200 4
25396 199 2

Noob

25397 199 3
25397 199 3
25397 199 3
25400 199 3