# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1049904 | 2024-08-09T06:01:25 Z | vjudge1 | Art Exhibition (JOI18_art) | C++ | 4 ms | 444 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n; long long a[n], b[n]; for(int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } long long ans = -1e18; for(int i = 1; i < (1 << n); i++){ long long mx = 0; long long mn = 1e18; long long sum = 0; for(int j = 0; j < n; j++){ if((i >> j) & 1){ mx = max(mx, a[j]); mn = min(mn, a[j]); sum += b[j]; } } ans = max(ans, sum + mn - mx); } cout << ans << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 444 KB | Output is correct |
3 | Correct | 3 ms | 348 KB | Output is correct |
4 | Correct | 3 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 436 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 444 KB | Output is correct |
3 | Correct | 3 ms | 348 KB | Output is correct |
4 | Correct | 3 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 436 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 344 KB | Output is correct |
12 | Incorrect | 2 ms | 344 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 444 KB | Output is correct |
3 | Correct | 3 ms | 348 KB | Output is correct |
4 | Correct | 3 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 436 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 344 KB | Output is correct |
12 | Incorrect | 2 ms | 344 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 444 KB | Output is correct |
3 | Correct | 3 ms | 348 KB | Output is correct |
4 | Correct | 3 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 436 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 344 KB | Output is correct |
12 | Incorrect | 2 ms | 344 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |