Submission #926289

# Submission time Handle Problem Language Result Execution time Memory
926289 2024-02-12T18:23:30 Z Toast Snail (NOI18_snail) C++14
25 / 100
1000 ms 604 KB
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

int main() {
    long H,N;
    long currentheight=0;
    long currentphase=0;
    long temp = -1;
    string P;
    bool flag=true;
    cin >> H >> N;
    cin.ignore();
    getline(cin, P);
    stringstream ss(P);
    vector<int>v;
    while (getline(ss,P,' ')) {
        v.push_back(stoi(P));
    }
    long currentday = -1;
    while (flag) {
        currentday++;
        for (int i=0;i<N;i++) {
            if (currentheight+v[i]<0) {
                currentheight = 0;
            }
            else {
                currentheight +=v[i];
            }
            if (currentheight>=H) {
                flag=false;
                currentphase=i;
                cout << currentday << " " << currentphase;
                break;
            }
        }
        if (temp==currentheight) {
            flag = false;
            cout << -1 << " " << -1; 
        }
        temp = currentheight;
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Execution timed out 1083 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -