제출 #1257743

#제출 시각아이디문제언어결과실행 시간메모리
1257743jahongir운세 보기 2 (JOI14_fortune_telling2)C++20
4 / 100
3093 ms676 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T,null_type,less_equal<T>,rb_tree_tag, tree_order_statistics_node_update>; #define ll long long #define pi pair<int,int> #define vi vector<int> #define pb push_back #define all(a) a.begin(),a.end() const int mxn = 2e5+10; int arr[mxn][2]; void solve(){ int n,q; cin >> n >> q; for(int i = 1; i <= n; i++) cin >> arr[i][0] >> arr[i][1]; for(int i = 1; i <= q; i++){ int k; cin >> k; for(int j = 1; j <= n; j++) if(k >= arr[j][0]) swap(arr[j][0],arr[j][1]); } ll sum = 0; for(int i = 1; i <= n; i++) sum += arr[i][0]; cout << sum; } signed main(){ // freopen("cave.in","r",stdin); // freopen("cave.out","w",stdout); cin.tie(0)->sync_with_stdio(0); int t = 1; // cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...