#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <random>
#ifdef _MSC_VER
# include <intrin.h>
# define __builtin_popcountll __popcnt
#endif
//#include <atcoder/all>
//using namespace atcoder;
//typedef modint998244353 mint;
using namespace std;
typedef long long int lld;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
typedef vector<int> vi;
typedef vector<lld> vl;
typedef vector<ld> vld;
typedef vector<char> vch;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vivi;
typedef vector<vl> vlvl;
typedef vector<vch> vcvc;
typedef vector<vb> vbvb;
typedef vector<vs> vsvs;
const lld mod = 1000000000000;
const lld inf = 1LL << 56;
const int nom = 200000;
int main()
{
cin.tie(NULL), cout.tie(NULL);
ios::sync_with_stdio(false);
int n;
lld h, fa = -1, fb = -1;
cin >> h >> n;
vl vc(n);
for (int i = 0; i < n; ++i)
cin >> vc[i];
while (h > 0 && fa < 3000000)
{
fa++;
for (int i = 0; i < n; ++i)
{
h -= vc[i];
if (h < 0)
{
fb = i;
break;
}
}
}
if (fb == -1)
fa = -1;
cout << fa << ' ' << fb;
cout << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |