-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2039A.cpp
More file actions
54 lines (41 loc) · 777 Bytes
/
Copy path2039A.cpp
File metadata and controls
54 lines (41 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long
#define umap unordered_map
#define f(i, x, n) for (ll i = x; i < n; i++)
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
bool exists (vector<ll>& v, ll n) {
for (auto it : v)
{
if (it == n) return true;
}
return false;
}
int main() {
optimize();
ll t;
cin >> t;
while (t--) {
ll n;
cin >> n;
vector<ll> mods, ans;
mods.pb(0);
ans.pb(1);
ll elem = 1;
for (ll i = 2; i <= n; i++) {
elem++;
while (exists(mods, elem%i)) {
elem++;
}
mods.pb(elem%i);
ans.pb(elem);
}
for (auto it : ans) {
cout << it << " ";
}
cout << endl;
}
}