Submission #1365808

#TimeUsernameProblemLanguageResultExecution timeMemory
1365808afterzeroSnail (NOI18_snail)C++20
11 / 100
1 ms344 KiB
#include<bits/stdc++.h>
using namespace std ;

int main(){

long long h , n ;
cin >> h>> n ;

vector<long long>a(n);
long long sum = 0 ;
for(int i = 0 ; i< n ; i++){
    cin >> a[i];
    sum+=a[i];
}


    if(a[0]<=0){
            cout << -1 << " " << -1  << endl;
            return 0 ;
    }


  if(sum>h){ cout << "0 " ;
  if(h%a[0]==0){
    cout << (h/a[0])-1;
  }else{
      cout << int(h/a[0]);
  }

  }
  else{
    if(h%sum==0){
        cout << (h/sum)-1 << " " ;
        if(h%a[0]==0){
    cout << ((h/a[0])-1)%n;
  }else{
      cout << (int(h/a[0]))%n;
  }
    }else{

    cout << int(h/sum)<< " ";
    if(h%a[0]==0){
    cout << ((h/a[0])-1)%n;
  }else{
      cout << (int(h/a[0]))%n;
  }



    }











  }








}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...