H Day 1 ECPC 24
unknown
c_cpp
a year ago
871 B
4
Indexable
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; using ll = long long; template<class T> using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; void File() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); freopen("errors.txt", "w", stderr); #else #endif } int main() { // File(); int n, k; cin >> n >> k; vector<int> a(n); int cur = 1; for (int i = 0; i < k; ++i) for (int j = i; j < n; j += k) a[j] = cur++; for(auto &x: a) cout << x << " "; return 0; }
Editor is loading...
Leave a Comment