제출 #1129173

#제출 시각아이디문제언어결과실행 시간메모리
1129173jackofall718Snail (NOI18_snail)C++20
0 / 100
1 ms324 KiB
#include <bits/stdc++.h> #define ll long long int #define endl '\n' #define vn vector <ll> using namespace std; const int MAX_N = 1e9 + 7; #define pii pair <ll,ll> const ll INF = 0x3f3f3f3f3f3f3f3f; #define pb push_back #define srt(vp) sort(vp.begin(), vp.end()) int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int h,n; cin>>h>>n; vn v(n); ll sum=0; for (int i=0;i<n;i++){ cin>>v[i]; sum += v[i]; } if (sum <=0){ cout<<-1<<endl; } else{ ll rem = h%sum; if (rem==0)cout<<(h/sum)-1<<" "<<n-1; else{ ll curr=0; ll i=0; while (curr < rem){ curr += v[i]; i++; } cout<<(h/sum)<<" "<<i; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...