AtCoder Beginner Contest 063

Submission #1335627

Source codeソースコード

#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main()
{
	int n, a, b; cin >> n >> a >> b;
	a = a - b;
	int hp[100001] = { 0 }, h[100001] = { 0 };
	REP(i, n) {
		cin >> h[i];
	}
	long long count = 1, ookii = 0, ok = 1000000000, no = 0;
	while (1) {
		REP(i, 100001) { hp[i] = h[i]; }
		ookii = 0; int mae = count;
		count = (no + ok) / 2; //cout << count << endl;
		if (ok - no < 2) {
			cout << mae << endl; break;
		}
		for (int i = 0; i < n; i++)
		{
			hp[i] -= b*count;
			if (hp[i] > 0) {
				hp[i] -= a; i--; ookii++; 
				if (ookii > count) {
					break;
				}
			}
		}
		if (ookii <= count) {
			ok = count;
		}
		else {
			no = count;
		}
	}
	return 0;
}

Submission

Task問題 D - Widespread
User nameユーザ名 keidaroo
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 816 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - a01,a02,a03
All 0 / 400 a01,a02,a03,b04,b05,b06,b07,b08,b09,b10,b11,b12,b13

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
a01 AC 4 ms 1024 KB
a02 WA
a03 WA
b04 AC 4 ms 1024 KB
b05 WA
b06 WA
b07 WA
b08 AC 65 ms 1024 KB
b09 WA
b10 WA
b11 WA
b12 WA
b13 WA