当前位置:网站首页>[wrong question]
[wrong question]
2022-07-28 03:39:00 【wingaso】
#include<bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int n;
string A[N];
bool cmp(const string &a,const string &b){
return a + b < b + a;
}
int main(){
cin >> n;
for(int i = 0;i < n;i++){
cin >> A[i];
}
sort(A,A + n,cmp);
for(auto it : A)
printf("%s",it.c_str());
return 0;
}
The official solution to this problem is to establish a trie, Reduce the time complexity to O ( n ) O(n) O(n), But because of the platform environment , Can pass the card constant , use O ( l o g 2 n ) O(log_2n) O(log2n) The complexity of the code passes .
For this question , Compare the relationship between two numbers , It only needs a + b < b + a a+b < b + a a+b<b+a, That is, think from the perspective of digital integrity , You can't find local rules on every character in a number .
That is, we need to have a holistic thinking .
边栏推荐
- Unity simply implements the dialog function
- Assembly method of golang Gorm query arbitrary fields
- 如何让外网访问内网IP(esp8266网页使用)
- 收藏|0 基础开源数据可视化平台 FlyFish 大屏开发指南
- [错题]Mocha and Railgun
- Redis basic operation
- Malloc, free, calloc, realloc dynamic memory development functions in dynamic memory management
- How to use JDBC to operate database
- leetcode刷题:动态规划08(分割等和子集)
- 695. Maximum area of the island
猜你喜欢

Log analysis tool (Splunk)

53. Maximum subarray maximum subarray sum

LabVIEW加载和使用树型控件项目中的定制符号

Methods of SQL server backup database

如何卸载干净zabbix服务?(超详细)

Shell: resource monitoring script and high load alarm

Shell writing specifications and variables

Airiot Q & A issue 6 | how to use the secondary development engine?

Tensorboard usage record

The latest version of pagoda installs the zip extension, and PHP -m does not display the processing method
随机推荐
MSGAN用于多种图像合成的模式搜索生成对抗网络---解决模式崩塌问题
203. Remove linked list elements
Responsive high-end website template source code Gallery material resource download platform source code
Summary of concurrent programming interview questions
How to arrange PCB screen printing? Please check this manual!
同时导出多个excel,并且一个excel中包含多个sheet
Leetcode 208. implement trie (prefix tree) (2022.07.27)
我的创作纪念日
Outlook tutorial, how to use color categories and reminders in outlook?
Practice of online problem feedback module (16): realize the function of checking details
数字经济已成为最大看点
2022-07-27:小红拿到了一个长度为N的数组arr,她准备只进行一次修改, 可以将数组中任意一个数arr[i],修改为不大于P的正数(修改后的数必须和原数不同), 并使得所有数之和为X的倍数。
动态规划——1049. 最后一块石头的重量 II
MySQL stored procedures use cursors to synchronize data between two tables
Outlook 教程,如何在 Outlook 中使用颜色类别和提醒?
贪心——45. 跳跃游戏 II
【5G NR】RRC Reject解析
Log analysis tool (Splunk)
CF question making record from July 25th to July 31st
How to solve the problem of win11 black desktop background?