結果
問題 | No.893 お客様を誘導せよ |
ユーザー | noisy_noimin |
提出日時 | 2019-09-27 21:28:50 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 2,629 bytes |
コンパイル時間 | 926 ms |
コンパイル使用メモリ | 102,244 KB |
実行使用メモリ | 4,512 KB |
最終ジャッジ日時 | 2023-10-25 01:47:35 |
合計ジャッジ時間 | 1,556 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 4 ms
4,348 KB |
testcase_03 | AC | 11 ms
4,348 KB |
testcase_04 | AC | 9 ms
4,348 KB |
testcase_05 | AC | 10 ms
4,348 KB |
testcase_06 | AC | 7 ms
4,348 KB |
testcase_07 | AC | 1 ms
4,348 KB |
testcase_08 | AC | 19 ms
4,512 KB |
testcase_09 | AC | 3 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 3 ms
4,348 KB |
testcase_12 | AC | 3 ms
4,348 KB |
ソースコード
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cassert> #include <cstdint> #include <iostream> #include <iomanip> #include <string> #include <stack> #include <queue> #include <vector> #include <map> #include <set> #include <algorithm> #include <numeric> #include <bitset> using namespace std; using ll = long long; using Pll = pair<ll, ll>; using Pii = pair<int, int>; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; const int MAX_N = 100000; template<typename T> class RSQ { public: int n, m; T zero = 0; T data[4*MAX_N]; T values[4*MAX_N]; RSQ(int m, T init_value=0): m(m) { // 2のべき乗にする n = 1; while(n < m) n <<= 1; zero = init_value; for(int i=0;i<2*n-1;++i){ data[i] = init_value; values[i] = init_value; } } void bottom_up_update(int i) { while(i){ i = (i-1)/2; data[i] = data[2*i+1] + data[2*i+2]; } } void update(int s, int t, T x){ s += n-1; t += n-1; if(s > n-1) values[s-1] += x; data[s-1] = values[s-1]?1:0; if(t > n-1) values[t-1] -= x; data[t-1] = values[t-1]?1:0; bottom_up_update(s-1); bottom_up_update(t-1); // for(int i=0;i<2*n-1;++i) { // cerr << data[i] << " "; // } // cerr << endl; // for(int i=n-1;i<2*n-1;++i) { // cerr << values[i] << " "; // } // cerr << endl; } // [s, t) T find(int s, int t, int k, int kl, int kr){ if(kr <= s || t <= kl) return zero; if(s <= kl && kr <= t) return data[k]; int kc = (kl+kr)/2; T vl = find(s, t, 2*k+1, kl, kc); T vr = find(s, t, 2*k+2, kc, kr); return vl + vr; } T find(int s, int t) { return find(s, t, 0, 0, n); } }; int main() { std::ios::sync_with_stdio(false); cin.tie(0); int n, p, a; cin >> n; deque<int> r[n]; for(int i=0;i<n;++i){ cin >> p; for(int j=0;j<p;++j) { cin >> a; r[i].push_back(a); } } vector<int> ans; bool finished = false; while(!finished) { finished = true; for(int i=0;i<n;++i) { if(r[i].empty()) continue; finished = false; ans.push_back(r[i].front()); r[i].pop_front(); } } for(int x: ans) { cout << x << " "; } cout << endl; }