제출 #1094379

#제출 시각아이디문제언어결과실행 시간메모리
1094379lenronType Printer (IOI08_printer)C++17
0 / 100
2 ms860 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int node_num=0,pcount=0; vector<vector<int>> trie(1000,vector<int>(26,0)); vector<bool> stop(100000,false); void insert(string word){ int node=0; for(char c:word){ if(trie[node][c-'a']==0){trie[node][c-'a']=++node_num;pcount++;} node=trie[node][c-'a']; } stop[node]=true; } string s=""; void dfs(int u){ int node=u; if(stop[node]==true){cout<<"P"<<endl;} for(int i=0;i<26;i++){ if(trie[node][i]==0){continue;} s.push_back(char('a'+i)); cout<<char('a'+i)<<endl; pcount--; int v=trie[node][i]; dfs(v); s.pop_back(); if(pcount==0){return;} cout<<"-"<<endl; } } void solve(){ ll n;cin>>n; for(int i=0;i<n;i++){ string s;cin>>s; insert(s); } dfs(0); } int main(){ solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...