Submission #8628656


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    reverse(all(s));
    vector<int> a(0);
    int e=0;
    while(true){
        if (e+m>=n) {
            a.push_back(n-e);
            break;
        }
        for (int i=m;i>0;i--){
            if (s[e+i]=='0'){
                a.push_back(i);
                e+=i;
                break;
            }
            if (i==1) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    reverse(all(a));
    rep(i,a.size()){
        cout << a[i] << " ";
    }
    cout << endl;
}

Submission Info

Submission Time
Task F - Sugoroku
User itigo
Language C++14 (GCC 5.4.1)
Score 600
Code Size 928 Byte
Status AC
Exec Time 13 ms
Memory 1144 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 60
Set Name Test Cases
Sample 00-sample-00, 00-sample-01, 00-sample-02
All 00-sample-00, 00-sample-01, 00-sample-02, 01-handmade-03, 01-handmade-04, 01-handmade-05, 01-handmade-06, 01-handmade-07, 01-handmade-08, 01-handmade-09, 01-handmade-10, 02-random-11, 02-random-12, 02-random-13, 02-random-14, 02-random-15, 02-random-16, 02-random-17, 02-random-18, 02-random-19, 02-random-20, 02-random-21, 02-random-22, 02-random-23, 02-random-24, 02-random-25, 02-random-26, 02-random-27, 02-random-28, 02-random-29, 02-random-30, 02-random-31, 02-random-32, 02-random-33, 02-random-34, 02-random-35, 02-random-36, 02-random-37, 02-random-38, 02-random-39, 02-random-40, 02-random-41, 02-random-42, 02-random-43, 02-random-44, 02-random-45, 02-random-46, 02-random-47, 02-random-48, 02-random-49, 02-random-50, 02-random-51, 02-random-52, 02-random-53, 02-random-54, 02-random-55, 02-random-56, 02-random-57, 02-random-58, 02-random-59
Case Name Status Exec Time Memory
00-sample-00 AC 1 ms 256 KB
00-sample-01 AC 1 ms 256 KB
00-sample-02 AC 1 ms 256 KB
01-handmade-03 AC 1 ms 256 KB
01-handmade-04 AC 5 ms 512 KB
01-handmade-05 AC 5 ms 512 KB
01-handmade-06 AC 5 ms 512 KB
01-handmade-07 AC 5 ms 512 KB
01-handmade-08 AC 5 ms 512 KB
01-handmade-09 AC 13 ms 1144 KB
01-handmade-10 AC 5 ms 768 KB
02-random-11 AC 4 ms 512 KB
02-random-12 AC 5 ms 512 KB
02-random-13 AC 4 ms 512 KB
02-random-14 AC 4 ms 512 KB
02-random-15 AC 4 ms 512 KB
02-random-16 AC 6 ms 512 KB
02-random-17 AC 5 ms 512 KB
02-random-18 AC 4 ms 512 KB
02-random-19 AC 4 ms 512 KB
02-random-20 AC 4 ms 512 KB
02-random-21 AC 5 ms 512 KB
02-random-22 AC 5 ms 512 KB
02-random-23 AC 4 ms 512 KB
02-random-24 AC 5 ms 512 KB
02-random-25 AC 4 ms 512 KB
02-random-26 AC 5 ms 512 KB
02-random-27 AC 4 ms 512 KB
02-random-28 AC 4 ms 512 KB
02-random-29 AC 4 ms 512 KB
02-random-30 AC 5 ms 512 KB
02-random-31 AC 5 ms 512 KB
02-random-32 AC 5 ms 512 KB
02-random-33 AC 4 ms 512 KB
02-random-34 AC 4 ms 512 KB
02-random-35 AC 4 ms 512 KB
02-random-36 AC 4 ms 512 KB
02-random-37 AC 4 ms 512 KB
02-random-38 AC 4 ms 512 KB
02-random-39 AC 4 ms 512 KB
02-random-40 AC 4 ms 512 KB
02-random-41 AC 4 ms 512 KB
02-random-42 AC 4 ms 512 KB
02-random-43 AC 5 ms 512 KB
02-random-44 AC 4 ms 512 KB
02-random-45 AC 4 ms 512 KB
02-random-46 AC 5 ms 512 KB
02-random-47 AC 4 ms 512 KB
02-random-48 AC 4 ms 512 KB
02-random-49 AC 4 ms 512 KB
02-random-50 AC 4 ms 512 KB
02-random-51 AC 4 ms 512 KB
02-random-52 AC 4 ms 512 KB
02-random-53 AC 4 ms 512 KB
02-random-54 AC 4 ms 512 KB
02-random-55 AC 4 ms 512 KB
02-random-56 AC 4 ms 512 KB
02-random-57 AC 5 ms 512 KB
02-random-58 AC 4 ms 512 KB
02-random-59 AC 4 ms 512 KB