結果
問題 |
No.5004 Room Assignment
|
ユーザー |
👑 ![]() |
提出日時 | 2021-12-01 00:53:29 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 148 ms / 5,000 ms |
コード長 | 2,367 bytes |
コンパイル時間 | 749 ms |
実行使用メモリ | 22,404 KB |
スコア | 137,985,820 |
平均クエリ数 | 7642.70 |
最終ジャッジ日時 | 2021-12-01 00:53:50 |
合計ジャッジ時間 | 20,082 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) //vector<int> block_separator = { // 0, 10, 20, 30, 47, 56, 64, 81, 91, 101 //}; vector<int> block_separator = { // 0, 11, 22, 32, 48, 55, 62, 79, 90, 101 // 0, 11, 22, 32, 43, 50, 57, 62, 79, 90, 101 // 0, 15, 26, 35, 44, 50, 57, 66, 75, 86, 101 // 0, 15, 26, 35, 41, 46, 50, 55, 60, 57, 66, 75, 86, 101 // 0, 16, 27, 35, 41, 46, 50, 55, 60, 57, 66, 74, 85, 101 // 0, 8, 16, 27, 35, 41, 46, 50, 55, 60, 57, 66, 74, 85, 92, 101 // 0,8,15,22,29,36,43,50,57,64,71,78,85,92,101 // 0,8,15,22,29,36,43,48,52,57,64,71,78,85,92,101 // 0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,101 0,8,15,20,25,30,35,40,44,48,52,56,60,65,70,75,80,85,93,101 }; int main(){ int num_block = block_separator.size() - 1; vector<int> block_size(num_block, 0); vector<int> block_id(num_block, -1); int num_tick; cin >> num_tick; int max_block_size; cin >> max_block_size; int next_player_id = 1; rep(tick_idx, num_tick){ int num_enter; cin >> num_enter; vector<pair<int,int>> buf; rep(enter_idx, num_enter){ int enter_id = next_player_id++; int player_skill; cin >> player_skill; int block_to_assign = upper_bound(block_separator.begin(), block_separator.end(), player_skill) - block_separator.begin() - 1; if(block_size[block_to_assign] == 0){ block_id[block_to_assign] = enter_id; block_size[block_to_assign]++; } else{ buf.push_back(make_pair(block_id[block_to_assign], enter_id)); block_size[block_to_assign]++; } if(block_size[block_to_assign] >= max_block_size){ block_id[block_to_assign] = -1; block_size[block_to_assign] = 0; } } cout << buf.size() << "\n"; for(auto a : buf){ cout << a.first << " " << a.second << "\n"; } cout << flush; } return 0; } struct ios_do_not_sync { ios_do_not_sync() { ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;