Submission #1071477

# Submission time Handle Problem Language Result Execution time Memory
1071477 2024-08-23T07:42:09 Z zh_h Snail (NOI18_snail) C++17
0 / 100
1000 ms 604 KB
#include <bits/stdc++.h>
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;
lint MOD = 1e9 + 7;
int INF = 1e9;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    lint height, n;
    cin >> height >> n;

    //* while taking the input, find:
    //* 1. the average move per day
    //* 2. the highest that you can reach per day

    vector<lint> p;
    lint ave=0, highest=0, lowest=0;
    lint count=0;
    for(lint i = 0; i < n; i ++){
        lint temp;
        cin >> temp;
        p.pb(temp);

        count += temp;
        // if(count < 0){count = 0;}
        highest = max(highest, count);
        lowest = min(lowest, count);

        ave += temp;
    }

    lint total = 0;
    lint days = 0;

    for(lint j = 0; j < 3; j ++){
        for(lint i = 0; i < n; i ++){
            total += p[i];
            if(total < 0){total = 0;}
            if(total >= height){cout << j << " " << i; break;}
        }
        if(total >= height){break;}
        days ++;
    }
    if(total == 0){cout << -1 << " " << -1;}
    else if(total < height){
        while(total < height-highest){
            total += ave;
            days++;
        }
        for(int i = 0; i < n; i ++){
            total += p[i];
            if(total >= height){cout << days << " " << i;}
        }
    }
    

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1096 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1097 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Incorrect 5 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1096 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -