結果

問題 No.701 ひとりしりとり
ユーザー hiro71687khiro71687k
提出日時 2023-08-26 23:47:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 858 bytes
コンパイル時間 4,558 ms
コンパイル使用メモリ 269,828 KB
実行使用メモリ 14,328 KB
最終ジャッジ日時 2023-08-26 23:47:10
合計ジャッジ時間 6,665 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 25 ms
4,516 KB
testcase_11 AC 304 ms
14,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1009999999999999990;
int main(){
    ll n;
    cin >> n;
    map<string,ll>memo;
    memo["a"]++;
    cout << "a" << endl;
    for (ll i = 0; i < n-1; i++)
    {
        while (1)
        {
            string s="a";
            for (ll j = 0; j < 18; j++)
            {
                char c='a';
                c+=rand()%26;
                s.push_back(c);
            }
            if (i==n-2)
            {
                s.push_back('n');
            }else{
                s.push_back('a');
            }
            if (memo[s]==0)
            {
                memo[s]++;
                cout << s << endl;
                break;
            }
        }
    }
}
0