제출 #1071477

#제출 시각아이디문제언어결과실행 시간메모리
1071477zh_hSnail (NOI18_snail)C++17
0 / 100
1097 ms604 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...