Submission #6667931


Source Code Expand

Copy
#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
Exec Time 19 ms
Memory 2168 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 500 / 500
Status
× 3
× 22
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 1 ms 256 KB
angel_homework_05.txt 1 ms 256 KB
angel_homework_06.txt 1 ms 256 KB
angel_homework_07.txt 2 ms 384 KB
angel_homework_08.txt 1 ms 256 KB
angel_homework_09.txt 1 ms 256 KB
angel_homework_10.txt 19 ms 2168 KB
angel_homework_11.txt 19 ms 2168 KB
angel_homework_12.txt 19 ms 2168 KB
angel_homework_13.txt 19 ms 2168 KB
angel_homework_14.txt 19 ms 2168 KB
angel_homework_15.txt 19 ms 2168 KB
angel_homework_16.txt 19 ms 2168 KB
angel_homework_17.txt 19 ms 2168 KB
angel_homework_18.txt 19 ms 2168 KB
angel_homework_19.txt 19 ms 2168 KB
angel_homework_20.txt 19 ms 2168 KB
angel_homework_21.txt 13 ms 1024 KB
angel_homework_22.txt 19 ms 2168 KB
angel_homework_s01.txt 1 ms 256 KB
angel_homework_s02.txt 1 ms 256 KB
angel_homework_s03.txt 1 ms 256 KB