Submission #567258

#TimeUsernameProblemLanguageResultExecution timeMemory
567258haxormanKitchen (BOI19_kitchen)C++14
0 / 100
2 ms212 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 307; int a[mxN], b[mxN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, k; cin >> n >> m >> k; if (m < k) { cout << "Impossible\n"; exit(0); } for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 0; i < m; ++i) { cin >> b[i]; } if (k == 1) { int ans = 0; for (int i = 0; i < n; ++i) { int mn = INT_MAX; for (int j = 0; j < m; ++j) { mn = min(mn, a[i] % b[j]); } ans += mn; } cout << ans << "\n"; } }
#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...