Code:
#include<iostream> #include<cstdio> #include<algorithm> #include<set> #include<vector> #include<utility> #include<map> #include<list> #include<queue> #include<stack> #include<cstring> #include<string> #include<cmath> #include<cstdlib> using namespace std; #define oo 1000000005 #define N 100005 #define rep(i,s,e) for(int i = s; i < e; i++) #define lop(i,s,e) for(int i = s; i != e; i++) #define FOR(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++) #define SZ(x) ((int)(x).size()) #define X first #define Y second typedef pair<int,int> II; typedef pair<II,int> D; typedef long long LL; vector<int> V; map<int,int> M; set<int> S; queue<int> Q; stack<int> ST; int n,k,x; int a[31]; int main() { #define Off false if(Off) { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); } cin >> n >> k; rep(i,0,k) { cin >> a[i]; S.insert(a[i]); } rep(i,0,k) { cout << a[i] << " "; int count = 1; rep(j, 1, n * k +1) { if(S.find(j) == S.end()) { cout << j << " "; S.insert(j); count++; } if(count == n)break; } cout << endl; } return 0; }
Không có nhận xét nào:
Đăng nhận xét