Submission #528061

# Submission time Handle Problem Language Result Execution time Memory
528061 2022-02-19T05:40:58 Z srivatsav_kannan Snail (NOI18_snail) C++14
0 / 100
1000 ms 460 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <numeric>
#include <stack>
#include <cstring>
#include <bitset>
#include <climits>
#include <valarray>
#include <list>
#define INF 1000000000
#define endl '\n'
#define int long long
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int k,n; cin >> k >> n;
    int sum = 0;
    int ar[n];
    for (int i = 0; i < n; i++){
        cin >> ar[i];
        sum += ar[i];
        if (sum >= k) {
            cout << 0 << " " << i << endl;
            return 0;
        }
    }
    if (sum <= 0){
        cout << "-1 -1\n";
        return 0;
    }
    if(n == 1){
        long double one = k, two = sum;
        cout << ceil(one/two)-1 << " " << 0 << endl;
        return 0;
    }
    int cur = 0;
    int day = -1, phase = 0;
    while (cur < k) {
        day++;
        for (int i = 0; i < n; i++){
            phase = i;
            cur += ar[i];
            if (cur >= k) break;
        }
    }
    cout << day << " " << phase << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 1041 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Execution timed out 1079 ms 332 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -