Untitled
Never
#include <iostream> #include <vector> #include <queue> #include <map> using namespace std; map<int, queue<int>> m; map<int, int> kid; vector<int> ans; vector<int> candy; int main(void){ int N, M, sz, tmpc, tmpcandy; cin >> N >> M; for(int i = 1; i <= N; i++){ cin >> kid[i]; for(int j = 0; j < kid[i]; j++){ cin >> tmpc; m[tmpc].push(i); } } for(int i = 0; i < M; i++){ cin >> tmpcandy; candy.push_back(tmpcandy); if(!m[tmpcandy].empty()){ ans.push_back(m[tmpcandy].front()); kid[m[tmpcandy].front()]--; m[tmpcandy].pop(); } else ans.push_back(0); } //cout << "ans\n"; for(int i = 0; i < M; i++){ if(kid[ans[i]] > 0) ans[i] = 0; cout << ans[i] << endl; } }
Raw Text
-
awertsdgvsdgdfhgfh
3 min ago
-
rsdetyfdhdfh
5 min ago
-
Untitled
6 min ago
-
Untitled
15 min ago
-
Untitled
19 min ago
-
Liv Pure Reviews UK
26 min ago
-
sxfsds
26 min ago
-
https://www.facebook.com/ReginaKetoGummiesInCanada/
27 min ago
-
Thinking About Hemp Labs Cbd Gummies? 10 Reasons Why It's Time To Stop!
48 min ago
-
How does the product work in the body?
1 hour ago