Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define pb push_back
- #define F first
- #define S second
- #define endl '\n'
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- #ifdef LOCAL
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #else
- freopen("backforth.in", "r", stdin);
- freopen("backforth.out", "w", stdout);
- #endif
- vector<int> bidoni1(10);
- vector<int> bidoni2(10);
- set<int> ans;
- for (int i = 0; i < 10; ++i)
- cin >> bidoni1[i];
- for (int j = 0; j < 10; ++j)
- cin >> bidoni2[j];
- for (int d1 = 0; d1 < 10; ++d1) {
- vector<int> bidoni11 = bidoni1;
- bidoni11.erase(bidoni11.begin()+d1);
- vector<int> bidoni21 = bidoni2;
- bidoni21.pb(bidoni1[d1]);
- ll now1 = 1000 - bidoni1[d1];
- for (int d2 = 0; d2 < 11; ++d2) {
- vector<int> bidoni12 = bidoni11;
- bidoni12.pb(bidoni21[d2]);
- vector<int> bidoni22 = bidoni21;
- bidoni22.erase(bidoni22.begin()+d2);
- ll now2 = now1 + bidoni21[d2];
- for (int d3 = 0; d3 < 10; ++d3) {
- vector<int> bidoni13 = bidoni12;
- bidoni13.erase(bidoni13.begin()+d3);
- vector<int> bidoni23 = bidoni22;
- bidoni23.pb(bidoni12[d3]);
- ll now3 = now2 - bidoni12[d3];
- for (int d4 = 0; d4 < 11; ++d4)
- ans.insert(now3 + bidoni23[d4]);
- }
- }
- }
- for (int i : ans)
- cerr << i << " ";
- cerr << endl;
- cout << ans.size() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement