Submission #714330

# Submission time Handle Problem Language Result Execution time Memory
714330 2023-03-24T08:57:19 Z vjudge1 Uplifting Excursion (BOI22_vault) C++17
0 / 100
139 ms 792 KB
#include<bits/stdc++.h>
using namespace std;
int res[64750];
int main () {
  for(int i = 0;i<64750;i++)res[i]=-2e9;
  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>=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 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Runtime error 139 ms 792 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Runtime error 139 ms 792 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Runtime error 139 ms 792 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Runtime error 139 ms 792 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Runtime error 139 ms 792 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -