优化!优化!
读入的字符串包含空格!
数据量较大,vector string都会降低效率
简直优化哭了要( ▼-▼ )
1 #include <cstdio> 2 #include <algorithm> 3 #include <cstring> 4 #include <cmath> 5 #include <string> 6 #include <iostream> 7 #include <vector> 8 using namespace std; 9 10 #define REP(n) for(int o=0;o<n;o++) 11 12 const int maxn = 1005; 13 14 int read(char s[]) { 15 char c; 16 int i = 0; 17 c = getchar(); 18 if(c == EOF) 19 return 0; 20 while(c != ' '&&c != EOF) { 21 s[i++] = c; 22 c = getchar(); 23 } 24 s[i] = '