# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
739603 | MODDI | Type Printer (IOI08_printer) | C++14 | 44 ms | 2564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n;
vector<string> str;
bool comp(string& a, string& b){
if(a.size() < b.size()) return true;
else return false;
}
int main(){
cin>>n;
str.resize(n);
for(int i = 0; i < n; i++)
cin>>str[i];
sort(str.begin(), str.end(), comp);
string printer;
vector<char> moves;
for(int i = 0; i < str.size(); i++){
while(printer.size() > str[i].size())
{
moves.pb('-');
printer.pop_back();
}
int first = 0;
while(first < str[i].size() && printer[first] == str[i][first]) first++;
// assert(false);
while(printer.size() > first)
{
printer.pop_back();
moves.pb('-');
}
// assert(false);
while(printer != str[i]){
printer.pb(str[i][first]);
moves.pb(str[i][first]);
first++;
}
moves.pb('P');
}
cout<<moves.size()<<endl;
for(auto t : moves)
cout<<t<<'\n';
return 0;
}
컴파일 시 표준 에러 (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... |