結果

問題 No.2453 Seat Allocation
ユーザー 沙耶花沙耶花
提出日時 2023-09-02 11:51:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 875 bytes
コンパイル時間 4,260 ms
コンパイル使用メモリ 263,236 KB
実行使用メモリ 9,680 KB
最終ジャッジ日時 2023-09-07 15:38:30
合計ジャッジ時間 8,593 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 227 ms
8,096 KB
testcase_06 AC 171 ms
4,560 KB
testcase_07 AC 36 ms
7,308 KB
testcase_08 AC 20 ms
4,380 KB
testcase_09 AC 246 ms
8,828 KB
testcase_10 AC 245 ms
7,840 KB
testcase_11 AC 244 ms
7,716 KB
testcase_12 AC 169 ms
4,688 KB
testcase_13 AC 173 ms
4,740 KB
testcase_14 AC 168 ms
4,600 KB
testcase_15 AC 180 ms
4,712 KB
testcase_16 AC 166 ms
4,720 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 184 ms
6,252 KB
testcase_19 AC 208 ms
9,680 KB
testcase_20 AC 82 ms
5,748 KB
testcase_21 AC 123 ms
4,380 KB
testcase_22 AC 183 ms
5,196 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

struct value{

	long long a,b;
	int ind;
	bool operator<(const value &another)const{
		if (a * another.b != b * another.a){
			return a* another.b < b * another.a;
		}
		return another.ind < ind;
	}
	
};

int main(){
	
	priority_queue<value> Q;
	int n,m;
	cin>>n>>m;
	vector<long long> a(n),b(m);
	rep(i,n){
		cin>>a[i];
	}
	rep(i,m)cin>>b[i];
	b.push_back(Inf32+5);
	rep(i,n){
		value t;
		t.a = a[i];
		t.b = b[0];
		t.ind  =i;
		Q.push(t);
	}
	rep(i,m){
		auto t = Q.top();
		Q.pop();
		cout<<t.ind+1<<endl;
		int d = distance(b.begin(),lower_bound(b.begin(),b.end(),t.b));
		t.b = b[d+1];
		Q.push(t);
	}
		
	return 0;
}
0