Submission #870281

# Submission time Handle Problem Language Result Execution time Memory
870281 2023-11-07T12:04:30 Z Essa2006 Type Printer (IOI08_printer) C++14
0 / 100
19 ms 2140 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "t" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "e" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "h" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 448 KB Expected integer, but "b" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 724 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1116 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2140 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1884 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -