| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 533835 | __Variatto | Type Printer (IOI08_printer) | C++17 | 26 ms | 2100 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=25e3+10, A=30;
int n;
vector<int>all[A];
string s[MAX];
int naj(string a, string b){
string a1, b1;
for(int i=0; i<min(a.size(), b.size()); i++){
a1+=a[i], b1+=b[i];
if(a1!=b1)
return i;
}
return min(a.size(), b.size());
}
void wypisz(int i, int j){
int ile=naj(s[i], s[j]);
int ile2=s[i].size()-ile;
while(ile2--)
cout<<"-\n";
for(int k=ile; k<s[j].size(); k++)
cout<<s[j][k]<<"\n";
cout<<"P\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin>>n;
pair<int,int>maxi={0,0};
for(int i=1; i<=n; i++){
cin>>s[i];
maxi=max(maxi, {s[i].size(), i});
}
sort(s+1, s+n+1);
int wynik=0, last=0;
for(int i=1; i<=n; i++){
if(s[i][0]==s[maxi.se][0])
continue;
wynik+=s[last].size()+s[i].size()-2*naj(s[i-1], s[i]);
wypisz(last, i);
last=i;
//cot<<last<<" "<<s[i].size()<<" "<<naj(s[i-1], s[i])<<"\n";
}
for(int i=1; i<=n; i++){
if(s[i][0]!=s[maxi.se][0])
continue;
wynik+=s[last].size()+s[i].size()-2*naj(s[i-1], s[i]);
wypisz(last, i);
last=i;
}
cout<<wynik+n<<"\n";
}컴파일 시 표준 에러 (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... | ||||
