# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108360 | 2024-11-04T01:21:28 Z | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 1000 ms | 4576 KB |
#include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e6 + 5; int n, a[N], b[N]; int res = 0, c[N]; void check(){ int amin = 1e18; int amax = 0; int sum = 0; int cnt = 0; for(int i = 1; i <= n; i++){ if(c[i] == 1){ amin = min(a[i], amin); amax = max(a[i], amax); sum += b[i]; cnt++; } } if(cnt != 0) res = max(res, sum - (amax - amin)); } void sinh_np(int i){ for(int j = 0; j <= 1; j++){ c[i] = j; if(i == n) check(); else sinh_np(i + 1); } } int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #define Task "Flower" if(fopen(Task".inp","r")){ freopen(Task".inp","r",stdin); freopen(Task".out","w",stdout); } cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i] >> b[i]; } sinh_np(1); cout << res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4432 KB | Output is correct |
2 | Correct | 6 ms | 4432 KB | Output is correct |
3 | Correct | 4 ms | 4432 KB | Output is correct |
4 | Correct | 4 ms | 4576 KB | Output is correct |
5 | Correct | 4 ms | 4432 KB | Output is correct |
6 | Correct | 4 ms | 4568 KB | Output is correct |
7 | Correct | 4 ms | 4432 KB | Output is correct |
8 | Correct | 4 ms | 4432 KB | Output is correct |
9 | Correct | 5 ms | 4432 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 5 ms | 4564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4432 KB | Output is correct |
2 | Correct | 6 ms | 4432 KB | Output is correct |
3 | Correct | 4 ms | 4432 KB | Output is correct |
4 | Correct | 4 ms | 4576 KB | Output is correct |
5 | Correct | 4 ms | 4432 KB | Output is correct |
6 | Correct | 4 ms | 4568 KB | Output is correct |
7 | Correct | 4 ms | 4432 KB | Output is correct |
8 | Correct | 4 ms | 4432 KB | Output is correct |
9 | Correct | 5 ms | 4432 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 5 ms | 4564 KB | Output is correct |
12 | Execution timed out | 1047 ms | 4432 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4432 KB | Output is correct |
2 | Correct | 6 ms | 4432 KB | Output is correct |
3 | Correct | 4 ms | 4432 KB | Output is correct |
4 | Correct | 4 ms | 4576 KB | Output is correct |
5 | Correct | 4 ms | 4432 KB | Output is correct |
6 | Correct | 4 ms | 4568 KB | Output is correct |
7 | Correct | 4 ms | 4432 KB | Output is correct |
8 | Correct | 4 ms | 4432 KB | Output is correct |
9 | Correct | 5 ms | 4432 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 5 ms | 4564 KB | Output is correct |
12 | Execution timed out | 1047 ms | 4432 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4432 KB | Output is correct |
2 | Correct | 6 ms | 4432 KB | Output is correct |
3 | Correct | 4 ms | 4432 KB | Output is correct |
4 | Correct | 4 ms | 4576 KB | Output is correct |
5 | Correct | 4 ms | 4432 KB | Output is correct |
6 | Correct | 4 ms | 4568 KB | Output is correct |
7 | Correct | 4 ms | 4432 KB | Output is correct |
8 | Correct | 4 ms | 4432 KB | Output is correct |
9 | Correct | 5 ms | 4432 KB | Output is correct |
10 | Correct | 4 ms | 4432 KB | Output is correct |
11 | Correct | 5 ms | 4564 KB | Output is correct |
12 | Execution timed out | 1047 ms | 4432 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |