标签:组成 input The RoCE under content ram sign rod
#include <map> #include <set> #include <stack> #include <cmath> #include <queue> #include <cstdio> #include <vector> #include <string> #include <cstring> #include <iostream> #include <algorithm> #define debug(a) cout << #a << " " << a << endl using namespace std; const int maxn = 1e5 + 10; const int mod = 1e9 + 7; typedef long long ll; ll x, n, m, vis[maxn], a[maxn]; int main(){ std::ios::sync_with_stdio(false); cin >> n >> m; memset( vis, -1, sizeof(vis) ); for( ll i = 0; i < n; i ++ ) { cin >> x; if( vis[x] == -1 ) { for( ll j = max( (ll)0, x-m+1 ); j <= x; j ++ ) { if( vis[j] == -1 || vis[j] == j ) { for( ll k = j; k <= x; k ++ ) { vis[k] = j; } } } } a[i] = vis[x]; } for( ll i = 0; i < n; i ++ ) { if( i == n-1 ) { cout << a[i] << endl; } else { cout << a[i] << " "; } } return 0; }
标签:组成 input The RoCE under content ram sign rod
原文地址:https://www.cnblogs.com/l609929321/p/9250483.html