結果

問題 No.3221 Count Turns
ユーザー Iroha_3856
提出日時 2025-08-01 22:24:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 779 bytes
コンパイル時間 3,121 ms
コンパイル使用メモリ 283,976 KB
実行使用メモリ 9,216 KB
最終ジャッジ日時 2025-08-01 22:25:06
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 30 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:17:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   17 | main() {
      | ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/segtree>

#define int long long

int N;
vector<int> B;

int op(int a, int b) {
	if (B[a] <= B[b]) return a;
	return b;
}

int e() { return N; }

main() {
	int H, T; cin >> N >> H >> T;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	
	vector<int> R(N+1);
	for (int i = 0; i < N; i++) {
		R[i] = (H + A[i] - 1) / A[i];
	}
	R[N] = 1e9;
	
	B = R;
	
	vector<int> P(N); iota(P.begin(), P.end(), 0);
	atcoder::segtree<int, op, e> seg(P);
	int all = 0;
	vector<int> C(N, 0);
	
	for (int i = 0; i < T; i++) {
		int id = seg.all_prod();
		C[id]++;
		int cnt = max(0LL, B[id] - all);
		all += cnt;
		B[id] = R[id] + all;
		seg.set(id, id);
	}
	
	for (int i = 0; i < N; i++) cout << C[i] << " ";
	cout << endl;
}
0