| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 63171 | nvmdava | Type Printer (IOI08_printer) | C++17 | 5 ms | 1032 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
struct Node{
char val;
Node *let[26];
int maxId, lon = 0, size = 0;
bool operator<(const Node* rhs) const{
if(this == NULL){
return 1;
}
return lon < rhs -> lon;
}
void sorter(){
sort(let, let + 26);
lon = let[25] -> lon + 1;
for(int i = 0;i <= 25; i++){
size += let[i] -> size;
}
size+=2;
}
} *root[26];
void insert(string s, Node* now, int i, int len){
if(i == len){
return;
}
if(now -> let[s[i] - 'a'] == NULL){
now -> let[s[i] - 'a'] = new Node;
}
now = now -> let[s[i] - 'a'];
now -> val = s[i];
insert(s, now, i + 1, len);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, i;
for(i = 0; i <= 25; i++){
root[i] = new Node;
}
cin>>n;
string s;
for(i = 1; i <= n; i++){
cin>>s;
insert(s, root[s[0] - ' a'], 1, s.size());
}
int ans = 0;
for(i = 1; i <= n; i++){
root[i] -> sorter();
ans += root[i] -> size;
}
sort(root, root + 26);
ans -= root[25] -> lon;
cout<<ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
