Submission #6667931
Source Code Expand
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧_∧
∧_∧ (´<_` ) Welcome to My Coding Space!
( ´_ゝ`) / ⌒i @hamayanhamayan
/ \ | |
/ / ̄ ̄ ̄ ̄/ |
__(__ニつ/ _/ .| .|____
\/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/
int N, A[201010];
//---------------------------------------------------------------------------------------------------
int solve() {
reverse(A, A + N);
priority_queue<int> que;
int ans = 0;
int top = 0;
while (top < N) {
que.push(A[top]);
int ma = que.top(); que.pop();
ans++;
top++;
ma--;
while (top < N and 0 < ma) {
que.push(A[top]);
top++;
ma--;
}
}
return ans;
}
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
rep(i, 0, N) cin >> A[i];
cout << solve() << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | K - 天使と宿題 |
| User | hamayanhamayan |
| Language | C++14 (GCC 5.4.1) |
| Score | 500 |
| Code Size | 1891 Byte |
| Status | AC |
| Exec Time | 19 ms |
| Memory | 2168 KiB |
Judge Result
| Set Name | Sample | Subtask1 | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | angel_homework_s01.txt, angel_homework_s02.txt, angel_homework_s03.txt |
| Subtask1 | angel_homework_s01.txt, angel_homework_s02.txt, angel_homework_s03.txt, angel_homework_04.txt, angel_homework_05.txt, angel_homework_06.txt, angel_homework_07.txt, angel_homework_08.txt, angel_homework_09.txt, angel_homework_10.txt, angel_homework_11.txt, angel_homework_12.txt, angel_homework_13.txt, angel_homework_14.txt, angel_homework_15.txt, angel_homework_16.txt, angel_homework_17.txt, angel_homework_18.txt, angel_homework_19.txt, angel_homework_20.txt, angel_homework_21.txt, angel_homework_22.txt, |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| angel_homework_04.txt | AC | 1 ms | 256 KiB |
| angel_homework_05.txt | AC | 1 ms | 256 KiB |
| angel_homework_06.txt | AC | 1 ms | 256 KiB |
| angel_homework_07.txt | AC | 2 ms | 384 KiB |
| angel_homework_08.txt | AC | 1 ms | 256 KiB |
| angel_homework_09.txt | AC | 1 ms | 256 KiB |
| angel_homework_10.txt | AC | 19 ms | 2168 KiB |
| angel_homework_11.txt | AC | 19 ms | 2168 KiB |
| angel_homework_12.txt | AC | 19 ms | 2168 KiB |
| angel_homework_13.txt | AC | 19 ms | 2168 KiB |
| angel_homework_14.txt | AC | 19 ms | 2168 KiB |
| angel_homework_15.txt | AC | 19 ms | 2168 KiB |
| angel_homework_16.txt | AC | 19 ms | 2168 KiB |
| angel_homework_17.txt | AC | 19 ms | 2168 KiB |
| angel_homework_18.txt | AC | 19 ms | 2168 KiB |
| angel_homework_19.txt | AC | 19 ms | 2168 KiB |
| angel_homework_20.txt | AC | 19 ms | 2168 KiB |
| angel_homework_21.txt | AC | 13 ms | 1024 KiB |
| angel_homework_22.txt | AC | 19 ms | 2168 KiB |
| angel_homework_s01.txt | AC | 1 ms | 256 KiB |
| angel_homework_s02.txt | AC | 1 ms | 256 KiB |
| angel_homework_s03.txt | AC | 1 ms | 256 KiB |