Submission #855069

# Submission time Handle Problem Language Result Execution time Memory
855069 2023-09-30T03:51:08 Z vjudge1 Type Printer (IOI08_printer) C++17
0 / 100
24 ms 3096 KB
#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

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 time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1116 KB printed invalid word
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1116 KB printed invalid word
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1116 KB printed invalid word
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1116 KB printed invalid word
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1112 KB printed invalid word
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1116 KB too many deletions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1368 KB too many deletions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1924 KB too many deletions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 3096 KB too many deletions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2524 KB too many deletions
2 Halted 0 ms 0 KB -