提出 #6703414


ソースコード 拡げる

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define ll long long
#define int ll
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
typedef pair <int, int> pii;

int n;
int initposition[101010];
int position[101010][25];
int ct[101010];
string str;
int32_t main()
{
    cin >> str;
    n = str.length();
    for (int i = 0; i<n; i++)
    {
        initposition[i] = i;
    }
    for (int i = 0; i<n; i++)
    {
        if (str[i] == 'L')
            position[i][0] = initposition[i]-1;
        if (str[i] == 'R')
            position[i][0] = initposition[i]+1;
    }
    for (int t = 1; t<=20; t++)
    {
        for (int i = 0; i<n; i++)
        {
            position[i][t] = position[position[i][t-1]][t-1];
        }
    }
    for (int i = 0; i<n; i++)
    {
        ct[position[i][20]]++;
    }
    for (int i = 0; i<n; i++)
    {
        printf("%lld ",ct[i]);
    }
    printf("\n");
}

提出情報

提出日時
問題 D - Gathering Children
ユーザ Gratus
言語 C++14 (GCC 5.4.1)
得点 400
コード長 1069 Byte
結果 AC
実行時間 27 ms
メモリ 21888 KiB

ジャッジ結果

セット名 All Sample
得点 / 配点 400 / 400 0 / 0
結果
AC × 21
AC × 3
セット名 テストケース
All sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18
Sample sample_01, sample_02, sample_03
ケース名 結果 実行時間 メモリ
sample_01 AC 1 ms 256 KiB
sample_02 AC 1 ms 256 KiB
sample_03 AC 1 ms 256 KiB
testcase_01 AC 17 ms 14976 KiB
testcase_02 AC 16 ms 14976 KiB
testcase_03 AC 26 ms 21888 KiB
testcase_04 AC 26 ms 21888 KiB
testcase_05 AC 17 ms 14720 KiB
testcase_06 AC 21 ms 19200 KiB
testcase_07 AC 26 ms 21632 KiB
testcase_08 AC 26 ms 21888 KiB
testcase_09 AC 7 ms 5888 KiB
testcase_10 AC 27 ms 21120 KiB
testcase_11 AC 27 ms 21888 KiB
testcase_12 AC 26 ms 21888 KiB
testcase_13 AC 26 ms 21888 KiB
testcase_14 AC 27 ms 21120 KiB
testcase_15 AC 27 ms 21120 KiB
testcase_16 AC 26 ms 21120 KiB
testcase_17 AC 27 ms 21120 KiB
testcase_18 AC 1 ms 256 KiB