# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582397 | 2022-06-23T17:28:04 Z | mohammad_kilani | Type Printer (IOI08_printer) | C++17 | 1000 ms | 246712 KB |
#include <bits/stdc++.h> using namespace std; #define oo 1000000010 #define mod 998244353 const int N = 25000; const int M = N * 20 + 1; string mx; bool compare(string &a,string &b){ for(int i = 0 ;i < (int)a.size() && i < (int)b.size();i++){ if(a[i] == b[i]) continue; if(a[i] == mx[i]) return false; if(b[i] == mx[i]) return true; return (a[i] < b[i]); } return (int)a.size() < (int)b.size(); } int main(){ int n; scanf("%d",&n); char tmpRead[21]; string s; vector< string > v; for(int i = 0 ;i < n;i++){ scanf("%s",tmpRead); s = (string)tmpRead; v.push_back(s); if((int)s.size() > (int)mx.size()) mx = s; } sort(v.begin(),v.end() , compare); string ans; for(int l, i = 0 ;i < (int)v.size();i++){ if(i != 0) ans += '\n'; l = 0; while(i != 0 && l < (int)v[i].size() && l < (int)v[i - 1].size() && v[i][l] == v[i - 1][l]) l++; for(int j = (int)v[i - 1].size();j > l;j--){ ans += '-'; ans += '\n'; } for(int j = l;j < (int)v[i].size();j++){ ans += v[i][j]; ans += '\n'; } ans += 'P'; } printf("%d\n",((int)ans.size() + 1) / 2); puts(ans.c_str()); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1104 ms | 246604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 246712 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 246708 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 1096 ms | 246660 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 468 KB | too many deletions |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Execution timed out | 1081 ms | 246708 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 852 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 1356 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 10 ms | 2060 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 2456 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |