제출 #567047

#제출 시각아이디문제언어결과실행 시간메모리
567047RealSnakeKitchen (BOI19_kitchen)C++14
0 / 100
1 ms212 KiB
#include "bits/stdc++.h" using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<pair<int, int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define mod 1000000007 ofstream fout(".out"); ifstream fin(".in"); signed main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, k; cin >> n >> m >> k; int a[n], b[m]; int x = 0; for(int i = 0; i < n; i++) { cin >> a[i]; x += a[i]; } int y = 0; for(int i = 0; i < m; i++) { cin >> b[i]; y += b[i]; } if(m == 1 && k == 1 && y >= x) { cout << y - x; return 0; } if(m == 2) { if(b[0] > b[1]) swap(b[0], b[1]); if(k == 1) { if(b[0] >= x) { cout << b[0] - x; return 0; } if(b[1] >= x) { cout << b[1] - x; return 0; } if(y >= x) { cout << y - x; return 0; } } else if(k == 2) { if(y >= x && b[0] >= n) { cout << y - x; return 0; } } } cout << "Impossible"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...