Submission #668562

#TimeUsernameProblemLanguageResultExecution timeMemory
668562highway_to_hellFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3065 ms2380 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define endl '\n' #define pb push_back #define mk make_pair #define sz size() #define F first #define S second #define all(x) x.begin(), x.end() #define kill(x) return cout << x << endl, void(); #define int ll #define pii pair <int, int> #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") //#pragma GCC target ("avx2") const int N = 1e6 + 5; const int MOD = 998244353, INF = 2e9, sq = 300; int a[2][N], c[N]; void Solve () { int n, k; cin >> n >> k; if (n > 40000 || k > 40000) return; for (int i = 0; i < n; i++) cin >> a[0][i] >> a[1][i]; for (int i = 0; i < k; i++) cin >> c[i]; int ans = 0; for (int i = 0; i < n; i++) { int wef = 0; for (int j = 0; j < k; j++) if (c[j] >= a[wef][i]) wef = 1 - wef; ans += a[wef][i]; } cout << ans << endl; } int32_t main () { ios::sync_with_stdio (0), cin.tie (0), cout.tie (0); int tt = 1; // cin >> tt; while (tt--) Solve (); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...