Submission #1100887

#TimeUsernameProblemLanguageResultExecution timeMemory
1100887proplayerFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3048 ms3664 KiB
#include<bits/stdc++.h> using namespace std; using lli = long long; const int maxN = 2e5 + 5; const int LG = 19; int a[maxN],b[maxN],t[maxN]; int sp[LG][maxN],pre[maxN],suf[maxN]; int lg[maxN]; int n,k; lli res; void input() { cin >> n >> k; for (int i = 1;i <= n;++i) cin >> a[i] >> b[i]; for (int i = 1;i <= k;++i) cin >> t[i]; } void solve() { res = 0; for (int i = 1;i <= n;++i) { for (int j = 1;j <= k;++j) { if (a[i] <= t[j]) swap(a[i],b[i]); } res += a[i]; } cout << res; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //freopen("P1.inp","r",stdin); //freopen("P1.out","w",stdout); input(); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...