| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366370 | afterzero | Snail (NOI18_snail) | C++20 | 1 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std ;
int main(){
long long h , n ;
cin >> h >> n ;
vector<long long>a(n);
vector<long long> pref(n);
long long sum = 0 ;
for(int i = 0 ; i < n ; i++){
cin >> a[i];
sum += a[i];
}
if( sum<= 0){
cout << -1 << " " << -1 << endl;
return 0 ;
}
pref[0] = a[0];
for(int i = 1 ; i< n ;i++){
pref[i] = pref[i-1] + a[i];
}
if(sum >= h){
cout << 0 << " " ;
for(int i = 0 ; i < n ; i++){
if(pref[i] >= sum){
cout << i - 1 ;
}
}
} else {
if(h % sum == 0){
cout << (h / sum) - 1 << " " << 0 ;
} else {
long long x = (h / sum);
cout << x << " ";
long long l = h - (long long)(sum * x) ;
for(int i = 0 ; i < n ; i++){
if(pref[i] >= l){
cout << i - 1 ;
}
}
}
}
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
