| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1002590 | vjudge1 | Type Printer (IOI08_printer) | C++14 | 30 ms | 18636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int sz=5e5+1;
int trie[sz][26];
int bitdi[sz];
int last=0,cnt=0;
vector<char> cvb;
int n;
void qur(string s){
int curr=0;
for(auto &i : s){
if(trie[curr][i - 'a'])curr = trie[curr][i - 'a'];
else curr = trie[curr][i - 'a'] = ++last;
}
bitdi[curr]++;
}
void dfs(int node){
if(bitdi[node]){
for(int i=0;i<bitdi[node];++i)cvb.push_back('p');
cnt += bitdi[node];
}
if(cnt == n)return;
for(int i=0;i<26;++i){
if(trie[node][i]){
cvb.push_back(char('a' + i));
dfs(trie[node][i]);
}
}
cvb.push_back('-');
}
int main(){
cin >> n;
string a;
for(int i=0;i<n;++i){
cin >> a;
qur(a);
}
dfs(0);
cout << cvb.size() << '\n';
for(auto &i : cvb)cout << i << '\n';
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
