# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
888332 | hwy | Fortune Telling 2 (JOI14_fortune_telling2) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n, k;
vector<pair<ll, ll>> cards;
vector<ll> ops;
ll ans = 0;
ll curr_num;
for (ll i = 0; i < n; i++) {
ll a, b;
cin >> a >> b;
cards.push_back({a, b});
}
for (ll i = 0; i < k; i++) {
ll temp;
cin >> temp;
ops.push_back(temp);
}
for (ll i = 0; i < n; i++) {
curr_num = cards[i].first;
for (ll j = 0; j < k; j++) {
if (curr_num <= ops[j]) {
if (curr_num == cards[i].first)
curr_num = cards[i].second;
else if (curr_num == cards[i].second)
curr_num = cards[i].first;
}
}
ans += curr_num;
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |