Submission #364323

#TimeUsernameProblemLanguageResultExecution timeMemory
364323Kevin_Zhang_TWFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3088 ms1516 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); } template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; } #else #define DE(...) 0 #define debug(...) 0 #endif const int MAX_N = 300010; int a[MAX_N], b[MAX_N], t[MAX_N], n, m; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m; for (int i = 0;i < n;++i) cin >> a[i] >> b[i]; for (int i = 0;i < m;++i) cin >> t[i]; for (int i = 0;i < n;++i) for (int j = 0;j < m;++j) if (a[i] <= t[j]) swap(a[i], b[i]); cout << accumulate(a, a+n, 0ll) << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...