# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
926276 | 2024-02-12T18:14:10 Z | Toast | Snail (NOI18_snail) | C++14 | 3 ms | 1116 KB |
#include <iostream> #include <vector> #include <string> #include <sstream> #include <cmath> using namespace std; int main() { double H,N,diff,total; long currentheight=0; long currentphase=0; long temp = -1; bool flag = true; string P; 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; for (int i=0;i<2;i++) { 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) { cout << -1 << " " << -1; flag = false; break; } diff = currentheight-temp; temp = currentheight; } while (flag) { currentday=ceil((H-currentheight+diff)/diff); temp = (currentday)*diff; for (int i=0;i<N;i++) { if (v[i]+temp>=H) { cout << currentday << " " << i; flag = false; break; } else { temp+=v[i]; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 604 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 604 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Runtime error | 3 ms | 1116 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 604 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |