diff options
Diffstat (limited to 'cses')
| -rw-r--r-- | cses/SortingAndSearching/Apartments/main.cpp | 24 | ||||
| -rwxr-xr-x | cses/SortingAndSearching/SumOfTwoValues/main | bin | 0 -> 63968 bytes | |||
| -rw-r--r-- | cses/SortingAndSearching/SumOfTwoValues/main.cpp | 29 | ||||
| -rw-r--r-- | cses/SortingAndSearching/SumOfTwoValues/main_input0.txt | 2 | ||||
| -rw-r--r-- | cses/SortingAndSearching/SumOfTwoValues/main_input1.txt | 2 | ||||
| -rw-r--r-- | cses/SortingAndSearching/SumOfTwoValues/main_output0.txt | 1 | ||||
| -rw-r--r-- | cses/SortingAndSearching/SumOfTwoValues/main_output1.txt | 1 |
7 files changed, 59 insertions, 0 deletions
diff --git a/cses/SortingAndSearching/Apartments/main.cpp b/cses/SortingAndSearching/Apartments/main.cpp new file mode 100644 index 0000000..ce2b1ae --- /dev/null +++ b/cses/SortingAndSearching/Apartments/main.cpp @@ -0,0 +1,24 @@ +#include <algorithm> +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, m, k; + cin >> n >> m >> k; + vector<int> dsz(n); + for (auto &x : dsz) cin >> x; + vector<int> asz(m); + for (auto &x : asz) cin >> x; + set<int> taken; + sort(dsz.begin(), dsz.end()); + sort(asz.begin(), asz.end()); + bool mbigger = m > n; + if (mbigger) { + for (int i = 0; i < m; i++) { + } + } + +} diff --git a/cses/SortingAndSearching/SumOfTwoValues/main b/cses/SortingAndSearching/SumOfTwoValues/main Binary files differnew file mode 100755 index 0000000..c4730aa --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main diff --git a/cses/SortingAndSearching/SumOfTwoValues/main.cpp b/cses/SortingAndSearching/SumOfTwoValues/main.cpp new file mode 100644 index 0000000..292e8f8 --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main.cpp @@ -0,0 +1,29 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, x; + cin >> n >> x; + vector<int> v(n); + for (auto &x : v) cin >> x; + map<int, int> mp; + pair<int, int> ans; + bool found = 0; + for (int i = 0; i < n; i++) mp[v[i]] = i + 1; + for (int i = 0; i < n; i++) { + if (mp.count(x - v[i]) && i + 1 != mp[x - v[i]]) { + ans.first = i + 1; + ans.second = mp[x - v[i]]; + found = 1; + break; + } + } + if (found) { + cout << ans.first << " " << ans.second; + } else { + cout << "IMPOSSIBLE"; + } +} diff --git a/cses/SortingAndSearching/SumOfTwoValues/main_input0.txt b/cses/SortingAndSearching/SumOfTwoValues/main_input0.txt new file mode 100644 index 0000000..a5153fc --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main_input0.txt @@ -0,0 +1,2 @@ +4 8 +2 7 5 1 diff --git a/cses/SortingAndSearching/SumOfTwoValues/main_input1.txt b/cses/SortingAndSearching/SumOfTwoValues/main_input1.txt new file mode 100644 index 0000000..5f4fbde --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main_input1.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3
\ No newline at end of file diff --git a/cses/SortingAndSearching/SumOfTwoValues/main_output0.txt b/cses/SortingAndSearching/SumOfTwoValues/main_output0.txt new file mode 100644 index 0000000..0efd67f --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main_output0.txt @@ -0,0 +1 @@ +2 4 diff --git a/cses/SortingAndSearching/SumOfTwoValues/main_output1.txt b/cses/SortingAndSearching/SumOfTwoValues/main_output1.txt new file mode 100644 index 0000000..6b29869 --- /dev/null +++ b/cses/SortingAndSearching/SumOfTwoValues/main_output1.txt @@ -0,0 +1 @@ +IMPOSSIBLE
\ No newline at end of file |
