记录一下,自己的菜鸡行为,哎,太菜了,以后有点脑子吧! #include <iostream> #include <vector> using namespace std; int main() { int T; cin >> T; while(T--) { //n是人数 m是角色数 int n,m; cin >> n >> m; vector<int> v1; vector<int> v2; while(n--) { int hope; cin >> hope; //cout << hope << endl; v1.push_back(hope); } while(m--) { int a; cin >> a; //cout << a << endl; v2.push_back(a); } for(int i=0; i<v1.size(); i++) { for(int j=0; j<v2.size(); j++) { //cout << v1[0]<< endl; if(v1[i] <= v2[j]) { cout << j+1 << " "; v2[j] = 0; break; } if(j == v2.size()-1) cout << -1 << " "; } } cout << endl; } return 0; }
全部评论
(1) 回帖