답안 #237241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237241 2020-06-05T11:51:00 Z wildturtle Type Printer (IOI08_printer) C++17
80 / 100
1000 ms 27428 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,t,maxx,idx;
pair < long long, string > A[200005],fix[200005];
string s1,s[200005];
vector < char> v;
int main() {
           cin>>n;
           for(long long i=1;i<=n;i++) {
                      cin>>s[i];
                      if(maxx<s[i].size()) { maxx=s[i].size(); s1=s[i]; }
           }
           for(long long i=1;i<=n;i++) {
                      A[i].second=s[i]; k=0;
                      for(long long j=0;j<s[i].size();j++)
                      if(s[i][j]!=s1[j]) break;
                      else k++;
                      A[i].first=k;
           }
           sort(A+1,A+1+n);
           idx=0;
           for(long long i=1;i<=n;i++) {
                      for(long long j=idx;j<A[i].second.size();j++)
                      v.push_back(A[i].second[j]);
                      v.push_back('P');
                      if(i==n) break;
                      idx=A[i].second.size();
                      for(long long j=0;j<A[i].second.size();j++) {
                                 if(A[i].second[j]!=A[i+1].second[j]) { idx=j; break; }
                      }
                      for(long long j=idx;j<A[i].second.size();j++)
                      v.push_back('-');
           }
           cout<<v.size()<<endl;
           for(long long i=0;i<v.size();i++)
           cout<<v[i]<<endl;
}

Compilation message

printer.cpp: In function 'int main()':
printer.cpp:11:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       if(maxx<s[i].size()) { maxx=s[i].size(); s1=s[i]; }
                          ~~~~^~~~~~~~~~~~
printer.cpp:15:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       for(long long j=0;j<s[i].size();j++)
                                         ~^~~~~~~~~~~~
printer.cpp:23:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       for(long long j=idx;j<A[i].second.size();j++)
                                           ~^~~~~~~~~~~~~~~~~~~
printer.cpp:28:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       for(long long j=0;j<A[i].second.size();j++) {
                                         ~^~~~~~~~~~~~~~~~~~~
printer.cpp:31:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       for(long long j=idx;j<A[i].second.size();j++)
                                           ~^~~~~~~~~~~~~~~~~~~
printer.cpp:35:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
            for(long long i=0;i<v.size();i++)
                              ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 22144 KB Output is correct
2 Correct 17 ms 22272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 22400 KB Output is correct
2 Correct 18 ms 22272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 22272 KB Output is correct
2 Correct 28 ms 22272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 22184 KB Output is correct
2 Correct 17 ms 22272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 22272 KB Output is correct
2 Correct 33 ms 22272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 22304 KB Output is correct
2 Correct 54 ms 22520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 22648 KB Output is correct
2 Correct 237 ms 23032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 292 ms 23112 KB Output is correct
2 Correct 105 ms 22776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 689 ms 24132 KB Output is correct
2 Execution timed out 1095 ms 26732 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 572 ms 23536 KB Output is correct
2 Execution timed out 1094 ms 27428 KB Time limit exceeded
3 Halted 0 ms 0 KB -