Submission #364325

#TimeUsernameProblemLanguageResultExecution timeMemory
364325Kevin_Zhang_TW운세 보기 2 (JOI14_fortune_telling2)C++17
4 / 100
3088 ms748 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; #pragma GCC optimize("Ofast") int a[MAX_N][2], 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][0] >> a[i][1]; for (int i = 0;i < m;++i) cin >> t[i]; ll sum = 0; for (int i = 0;i < n;++i) { int c = 0; for (int j = 0;j < m;++j) if (a[i][c] <= t[j]) c ^= 1; sum += a[i][c]; } cout << sum << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...