Submission #855069

#TimeUsernameProblemLanguageResultExecution timeMemory
855069vjudge1Type Printer (IOI08_printer)C++17
0 / 100
24 ms3096 KiB
#include <iostream> #include <sstream> #include <string> #include <vector> #include <algorithm> using namespace std; typedef long long LL; #define fi first #define se second #define _for(ccc, sss, eee) for (int ccc=(sss);ccc<=(eee);ccc++) #define __for(ccc, sss, eee) for (int ccc=(sss);ccc>=(eee);ccc--) #define N 25000 #define INF 0x7f7f7f7f stringstream ss; int n, same_ind; bool first=true; string cur, in[N+10], _="-", P="P"; int main(){ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);//如果写freopen()删掉cout.tie() cin>>n; _for (i, 0, n-1)cin>>in[i]; sort(in, in+n); _for (i, 0, n-1){ if (first){ same_ind=0; first=false; } else{ for (same_ind=0;same_ind<min(cur.size(), in[i].size()) && cur[same_ind]==in[i][same_ind];same_ind++); _for (j, 1, max(cur.size(), in[i].size())-same_ind-1)ss<<_; } _for (j, same_ind, in[i].size()-1)ss<<in[i][j]; ss<<P; cur=in[i]; } string out; ss>>out; cout<<out.size()<<"\n"; for (auto &cur:out)cout<<cur<<"\n"; return 0; }

Compilation message (stderr)

printer.cpp: In function 'int main()':
printer.cpp:34:28: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
   34 |    for (same_ind=0;same_ind<min(cur.size(), in[i].size()) &&
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printer.cpp:11:51: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
   11 | #define _for(ccc, sss, eee) for (int ccc=(sss);ccc<=(eee);ccc++)
      |                                                   ^
printer.cpp:36:4: note: in expansion of macro '_for'
   36 |    _for (j, 1, max(cur.size(), in[i].size())-same_ind-1)ss<<_;
      |    ^~~~
printer.cpp:11:51: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define _for(ccc, sss, eee) for (int ccc=(sss);ccc<=(eee);ccc++)
      |                                                   ^
printer.cpp:38:3: note: in expansion of macro '_for'
   38 |   _for (j, same_ind, in[i].size()-1)ss<<in[i][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...