Submission #714335

# Submission time Handle Problem Language Result Execution time Memory
714335 2023-03-24T09:04:00 Z vjudge1 Uplifting Excursion (BOI22_vault) C++17
5 / 100
5000 ms 4300 KB
#include<bits/stdc++.h>
using namespace std;
long long res[510000];
int main () {
  for(int i = 0;i<510000;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>=510000) {
    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 = 510000-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<510000;j++) {
        if((j-(i-m))<510000)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 7 ms 4180 KB Output is correct
2 Correct 5 ms 4180 KB Output is correct
3 Correct 5 ms 4288 KB Output is correct
4 Correct 28 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 1155 ms 4272 KB Output is correct
7 Correct 478 ms 4268 KB Output is correct
8 Correct 1098 ms 4276 KB Output is correct
9 Correct 2040 ms 4264 KB Output is correct
10 Correct 42 ms 4180 KB Output is correct
11 Correct 39 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4180 KB Output is correct
2 Correct 5 ms 4180 KB Output is correct
3 Correct 5 ms 4288 KB Output is correct
4 Correct 28 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 1155 ms 4272 KB Output is correct
7 Correct 478 ms 4268 KB Output is correct
8 Correct 1098 ms 4276 KB Output is correct
9 Correct 2040 ms 4264 KB Output is correct
10 Correct 42 ms 4180 KB Output is correct
11 Correct 39 ms 4180 KB Output is correct
12 Correct 7 ms 4288 KB Output is correct
13 Correct 4 ms 4180 KB Output is correct
14 Correct 5 ms 4180 KB Output is correct
15 Correct 26 ms 4288 KB Output is correct
16 Correct 2 ms 4180 KB Output is correct
17 Correct 1182 ms 4264 KB Output is correct
18 Correct 469 ms 4272 KB Output is correct
19 Correct 1110 ms 4300 KB Output is correct
20 Correct 2041 ms 4300 KB Output is correct
21 Correct 43 ms 4180 KB Output is correct
22 Correct 38 ms 4180 KB Output is correct
23 Correct 2 ms 4180 KB Output is correct
24 Correct 4359 ms 4264 KB Output is correct
25 Correct 1517 ms 4268 KB Output is correct
26 Execution timed out 5061 ms 4180 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4180 KB Output is correct
2 Incorrect 2 ms 4180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4180 KB Output is correct
2 Incorrect 2 ms 4180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4180 KB Output is correct
2 Incorrect 2 ms 4180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4180 KB Output is correct
2 Correct 5 ms 4180 KB Output is correct
3 Correct 5 ms 4288 KB Output is correct
4 Correct 28 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 1155 ms 4272 KB Output is correct
7 Correct 478 ms 4268 KB Output is correct
8 Correct 1098 ms 4276 KB Output is correct
9 Correct 2040 ms 4264 KB Output is correct
10 Correct 42 ms 4180 KB Output is correct
11 Correct 39 ms 4180 KB Output is correct
12 Correct 26 ms 4180 KB Output is correct
13 Incorrect 2 ms 4180 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4180 KB Output is correct
2 Incorrect 2 ms 4180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4180 KB Output is correct
2 Correct 5 ms 4180 KB Output is correct
3 Correct 5 ms 4288 KB Output is correct
4 Correct 28 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 1155 ms 4272 KB Output is correct
7 Correct 478 ms 4268 KB Output is correct
8 Correct 1098 ms 4276 KB Output is correct
9 Correct 2040 ms 4264 KB Output is correct
10 Correct 42 ms 4180 KB Output is correct
11 Correct 39 ms 4180 KB Output is correct
12 Correct 7 ms 4288 KB Output is correct
13 Correct 4 ms 4180 KB Output is correct
14 Correct 5 ms 4180 KB Output is correct
15 Correct 26 ms 4288 KB Output is correct
16 Correct 2 ms 4180 KB Output is correct
17 Correct 1182 ms 4264 KB Output is correct
18 Correct 469 ms 4272 KB Output is correct
19 Correct 1110 ms 4300 KB Output is correct
20 Correct 2041 ms 4300 KB Output is correct
21 Correct 43 ms 4180 KB Output is correct
22 Correct 38 ms 4180 KB Output is correct
23 Correct 2 ms 4180 KB Output is correct
24 Correct 4359 ms 4264 KB Output is correct
25 Correct 1517 ms 4268 KB Output is correct
26 Execution timed out 5061 ms 4180 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4180 KB Output is correct
2 Incorrect 2 ms 4180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4180 KB Output is correct
2 Correct 5 ms 4180 KB Output is correct
3 Correct 5 ms 4288 KB Output is correct
4 Correct 28 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 1155 ms 4272 KB Output is correct
7 Correct 478 ms 4268 KB Output is correct
8 Correct 1098 ms 4276 KB Output is correct
9 Correct 2040 ms 4264 KB Output is correct
10 Correct 42 ms 4180 KB Output is correct
11 Correct 39 ms 4180 KB Output is correct
12 Correct 7 ms 4288 KB Output is correct
13 Correct 4 ms 4180 KB Output is correct
14 Correct 5 ms 4180 KB Output is correct
15 Correct 26 ms 4288 KB Output is correct
16 Correct 2 ms 4180 KB Output is correct
17 Correct 1182 ms 4264 KB Output is correct
18 Correct 469 ms 4272 KB Output is correct
19 Correct 1110 ms 4300 KB Output is correct
20 Correct 2041 ms 4300 KB Output is correct
21 Correct 43 ms 4180 KB Output is correct
22 Correct 38 ms 4180 KB Output is correct
23 Correct 2 ms 4180 KB Output is correct
24 Correct 4359 ms 4264 KB Output is correct
25 Correct 1517 ms 4268 KB Output is correct
26 Execution timed out 5061 ms 4180 KB Time limit exceeded
27 Halted 0 ms 0 KB -