結果
| 問題 |
No.893 お客様を誘導せよ
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2019-09-27 21:37:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 895 bytes |
| コンパイル時間 | 1,298 ms |
| コンパイル使用メモリ | 166,332 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 20:58:56 |
| 合計ジャッジ時間 | 2,067 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = MOD - 1;
const ll LLINF = 4e18;
int main() {
int n; cin >> n;
vector<queue<int>> a(n);
vector<int> ans;
int empty = 0;
REP(i, n) {
int p; cin >> p;
if (p == 0) empty++;
REP(j, p) {
int b; cin >> b;
a[i].push(b);
}
}
int now = -1;
while (empty < n) {
now = (now + 1) % n;
if (a[now].empty()) continue;
ans.push_back(a[now].front());
a[now].pop();
if (a[now].empty()) empty++;
}
REP(i, ans.size()) {
cout << ans[i] << " ";
}
cout << endl;
}
🍮かんプリン