Submission #714334

# Submission time Handle Problem Language Result Execution time Memory
714334 2023-03-24T09:02:16 Z vjudge1 Uplifting Excursion (BOI22_vault) C++17
5 / 100
547 ms 852 KB
#include<bits/stdc++.h>
using namespace std;
long long res[64750];
int main () {
  for(int i = 0;i<64750;i++)res[i]=-1e18;
  res[0]=0;
  long long m, l;
  cin >> m >> l;
  long long a[2*m+1];
  for(int i = 0;i<=2*m;i++) {
    cin >> a[i];
  }
  if(l<0) {
    l=-l;
    reverse(a,a+2*m+1);
  }
  if(l>=64750) {
    cout << "impossible\n";
    return 0;
  }
  for(int i = m+1;i<=2*m;i++) {
    for(int cnt=1;cnt<=a[i];cnt++) {
      for(int j = 64750-1;j>=(i-m);j--) {
        res[j]=max(res[j], res[j-(i-m)]+1);
      }
    }
  }
  for(int i = 0;i<=m-1;i++) {
    for(int cnt=1;cnt<=a[i];cnt++) {
      for(int j = 0;j<64750;j++) {
        if((j-(i-m))<64750)res[j]=max(res[j], res[j-(i-m)]+1);
      }
    }
  }
  res[l]+=a[m];
  if(res[l]<0)cout<<"impossible\n";
  else cout << (res[l]) << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 155 ms 844 KB Output is correct
7 Correct 59 ms 724 KB Output is correct
8 Correct 146 ms 788 KB Output is correct
9 Correct 267 ms 792 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 7 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 155 ms 844 KB Output is correct
7 Correct 59 ms 724 KB Output is correct
8 Correct 146 ms 788 KB Output is correct
9 Correct 267 ms 792 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 7 ms 812 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 2 ms 724 KB Output is correct
15 Correct 4 ms 724 KB Output is correct
16 Correct 1 ms 724 KB Output is correct
17 Correct 150 ms 792 KB Output is correct
18 Correct 60 ms 788 KB Output is correct
19 Correct 145 ms 792 KB Output is correct
20 Correct 257 ms 792 KB Output is correct
21 Correct 6 ms 724 KB Output is correct
22 Correct 6 ms 812 KB Output is correct
23 Correct 1 ms 816 KB Output is correct
24 Incorrect 547 ms 792 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 155 ms 844 KB Output is correct
7 Correct 59 ms 724 KB Output is correct
8 Correct 146 ms 788 KB Output is correct
9 Correct 267 ms 792 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 7 ms 812 KB Output is correct
12 Correct 4 ms 724 KB Output is correct
13 Incorrect 1 ms 724 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 155 ms 844 KB Output is correct
7 Correct 59 ms 724 KB Output is correct
8 Correct 146 ms 788 KB Output is correct
9 Correct 267 ms 792 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 7 ms 812 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 2 ms 724 KB Output is correct
15 Correct 4 ms 724 KB Output is correct
16 Correct 1 ms 724 KB Output is correct
17 Correct 150 ms 792 KB Output is correct
18 Correct 60 ms 788 KB Output is correct
19 Correct 145 ms 792 KB Output is correct
20 Correct 257 ms 792 KB Output is correct
21 Correct 6 ms 724 KB Output is correct
22 Correct 6 ms 812 KB Output is correct
23 Correct 1 ms 816 KB Output is correct
24 Incorrect 547 ms 792 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 155 ms 844 KB Output is correct
7 Correct 59 ms 724 KB Output is correct
8 Correct 146 ms 788 KB Output is correct
9 Correct 267 ms 792 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 7 ms 812 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 2 ms 724 KB Output is correct
15 Correct 4 ms 724 KB Output is correct
16 Correct 1 ms 724 KB Output is correct
17 Correct 150 ms 792 KB Output is correct
18 Correct 60 ms 788 KB Output is correct
19 Correct 145 ms 792 KB Output is correct
20 Correct 257 ms 792 KB Output is correct
21 Correct 6 ms 724 KB Output is correct
22 Correct 6 ms 812 KB Output is correct
23 Correct 1 ms 816 KB Output is correct
24 Incorrect 547 ms 792 KB Output isn't correct
25 Halted 0 ms 0 KB -