結果
| 問題 |
No.701 ひとりしりとり
|
| コンテスト | |
| ユーザー |
treeone
|
| 提出日時 | 2018-06-15 22:27:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,216 bytes |
| コンパイル時間 | 1,382 ms |
| コンパイル使用メモリ | 168,820 KB |
| 実行使用メモリ | 20,336 KB |
| 最終ジャッジ日時 | 2024-06-30 15:01:25 |
| 合計ジャッジ時間 | 3,712 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 9 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;
unsigned ww;
unsigned xor128() {
static unsigned x = 123456789, y = 362436069, z = 521288629/*, w = 88675123*/;
unsigned t = (x ^ (x << 11));
x = y; y = z; z = ww;
return (ww = (ww ^ (ww >> 19)) ^ (t ^ (t >> 8)));
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> ans;
set<string> st;
rep(i, 0, n){
string s = "";
while(1){
s = "";
if(i != 0) s += ans[i - 1][ans[i - 1].size() - 1];
while(s.size() < 20){
s += 'a' + xor128() % 26;
}
if(i == n - 1) s[s.size() - 1] = 'n';
if(!st.count(s)){
st.insert(s);
break;
}
}
ans.push_back(s);
}
for(int ii = 0; ii < ans.size(); ii++){
cout << ans[ii] << endl;
}
}
treeone