Submission #870281

#TimeUsernameProblemLanguageResultExecution timeMemory
870281Essa2006Type Printer (IOI08_printer)C++14
0 / 100
19 ms2140 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), a.end() #define mod (ll)(1000000007) int main(){ ios_base::sync_with_stdio(0);cin.tie(0); int n; cin>>n; vector<string>A(n); for(int i=0;i<n;i++){ cin>>A[i]; } sort(all(A)); vector<int>Same(n, -1); for(int i=1;i<n;i++){ for(int j=0;j<min(A[i].size(), A[i-1].size());j++){ if(A[i][j]==A[i-1][j]) Same[i]=j; else break; } } int cur=-1; for(int i=0;i<n;i++){ while(cur>Same[i]) cur--, cout<<'-'<<endl; for(int j=Same[i]+1;j<A[i].size();j++){ cout<<A[i][j]<<endl; cur++; } cout<<'P'<<endl; } }

Compilation message (stderr)

printer.cpp: In function 'int main()':
printer.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
   20 |         for(int j=0;j<min(A[i].size(), A[i-1].size());j++){
      |                     ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printer.cpp:31:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(int j=Same[i]+1;j<A[i].size();j++){
      |                             ~^~~~~~~~~~~~
#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...