Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define pf push_front
- #define mp make_pair
- #define sz size
- #define ll long long
- #define ld long double
- #define fs first
- #define sc second
- #define forn(i, f, t) for(int i = f; i < t; i++)
- #define all(x) (x).begin(), (x).end()
- #define ins insert
- const int INF = 2147483647;
- const int MOD = 1000000007;
- const ll INF64 = 9223372036854775807;
- const ld EPS = 1e-7;
- using namespace std;
- int gcd(int a, int b){
- return (b ? gcd(b, a % b) : a);
- }
- int ans[1000001];
- int main(){
- freopen("fence.in", "r", stdin);
- freopen("fence.out","w", stdout);
- int n, cur = 0, k = -1, oct = 0;
- scanf("%d\n", &n);
- forn(i, 0, n) ans[i] = -1;
- char c;
- bool fl = 0, fl1 = 0;
- vector<int> a;
- forn(i, 0, n){
- scanf("%c", &c);
- if (c == '#'){
- cur++;
- oct++;
- }
- else{
- if (cur && k == -1) k = cur;
- else if (cur) k = min(k, cur);
- cur = 0;
- }
- }
- if (cur && k == -1) k = cur;
- else if (cur) k = min(k, cur);
- if (k != -1) forn(i, 1, k + 1) ans[i * (oct / k) - 1] = (k / i + (k % i != 0) - 1);
- forn(i, 0, n) printf("%d ", ans[i]); printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement