Sum of Two Values
Problem LinkSolution by dudu — notes only
Code / Notes
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, S;
cin >> N >> S;
vector<pair<int, int>> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i].first;
A[i].second = i;
}
sort(A.begin(), A.end());
// Pra acessar o valor do número: A[i].first
// Pra acessar a posição inicial: A[i].second
}
Last updated 1 month, 2 weeks ago