Submission #888334

#TimeUsernameProblemLanguageResultExecution timeMemory
888334hwyFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3055 ms3032 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, k; cin >> 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...