結果

問題 No.701 ひとりしりとり
ユーザー troro_kelptroro_kelp
提出日時 2018-10-08 12:11:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,598 bytes
コンパイル時間 962 ms
コンパイル使用メモリ 108,368 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-20 18:30:07
合計ジャッジ時間 3,120 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
const constexpr int INF = 1e9;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;
struct Less{
   bool operator()(const pair<string, int>&a, const pair<string, int>&b){
        if(a.first==b.first){
            return a.second < b.second;
        }
       return a.first < b.first;
    }
};
const constexpr ll MOD = 1e9;


ll extGCD(ll a, ll b, ll& x, ll& y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}
ll GCD(ll a, ll b){
    if(a<b) swap(a, b);
    if(b==0) return a;
    return GCD(b, a%b);
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    vector<char> v;
    for(int i=0; i<10; ++i){
        v.push_back((char)'a'+i);
    }
    map<string, int> mp;
    int n; cin >> n;
    
    int cnt=0;
    
    do{
        string s;
        s+='a';
        for(int i=0; i<8; ++i){
            s+=v[i];
        }
        s+='a';
        if(mp[s]) continue;
        mp[s]++;
        cout << s << endl;
        cnt++;
        if(n==cnt) break;
    }while(next_permutation(v.begin(), v.end()));
    return 0;
}
0