1095. Cars on Campus (30)-PAT甲级真题(map,排序)

Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you are supposed to tell, at any specific time point, the number of cars parking on campus, and at the end of the day find the cars that have parked for the longest time period.

Input Specification:

Each input file contains one test case. Each case starts with two positive integers N (<= 10000), the number of records, and K (<= 80000) the number of queries. Then N lines follow, each gives a record in the format

plate_number hh:mm:ss status

where plate_number is a string of 7 English capital letters or 1-digit numbers; hh:mm:ss represents the time point in a day by hour:minute:second, with the earliest time being 00:00:00 and the latest 23:59:59; and status is either in or out.

Note that all times will be within a single day. Each "in" record is paired with the chronologically next record for the same car provided it is an "out" record. Any "in" records that are not paired with an "out" record are ignored, as are "out" records not paired with an "in" record. It is guaranteed that at least one car is well paired in the input, and no car is both "in" and "out" at the same moment

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/JCRM/OpenAS_6130_20240429/lib/user/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/log4j-slf4j-impl-2.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.51.B120/WEB-INF/lib/slf4j-log4j12-1.7.26.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.cloudcrm.jcrm.frame-0.0.1-SNAPSHOT/WEB-INF/lib/log4j-slf4j-impl-2.13.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] =============================================================================== Starting business container... com.huawei.bme.commons.uconfig.UConfigurationException: Parsing the policy file jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/com.huawei.soa.foundation.commons-6.1.00.B161.jar!/bme.basic.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-bme-3.5.20.SPC008/WEB-INF/lib/com.huawei.bme.web-3.5.20.SPC008.jar!/conf/bme.web.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-bme-3.5.20.SPC027/WEB-INF/lib/com.huawei.bme.web-3.5.20.SPC027.jar!/conf/bme.web.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-das-3.5.20.SPC008/WEB-INF/lib/com.huawei.bme.das.defaultdb-3.5.20.SPC008.jar!/conf/db.default.db.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-das-6.1.51.B120/WEB-INF/lib/com.huawei.bme.das.defaultdb-6.1.51.B120.jar!/conf/db.default.db.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/com.huawei.soa.foundation.jmx-6.1.00.B161.jar!/conf/jmx.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/com.huawei.soa.foundation.namingservice-6.1.00.B161.jar!/conf/namingservice.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/com.huawei.soa.foundation.prestatistics-6.1.00.B161.jar!/conf/prestatistics.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.00.B161/WEB-INF/lib/com.huawei.soa.foundation.trace-6.1.00.B161.jar!/conf/callchain.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.51.B120/WEB-INF/lib/com.huawei.soa.foundation.jmx-6.1.51.B120.jar!/conf/jmx.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.51.B120/WEB-INF/lib/com.huawei.soa.foundation.namingservice-6.1.51.B120.jar!/conf/namingservice.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.51.B120/WEB-INF/lib/com.huawei.soa.foundation.prestatistics-6.1.51.B120.jar!/conf/prestatistics.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-foundation-6.1.51.B120/WEB-INF/lib/com.huawei.soa.foundation.trace-6.1.51.B120.jar!/conf/callchain.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-adapter-dsf-6.1.00.B161/WEB-INF/lib/com.huawei.csc.usf.adapter.dsf-6.1.00.B161.jar!/conf/dsf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-adapter-dsf-6.1.00.B161/WEB-INF/lib/com.huawei.csc.usf.adapter.dsf-6.1.00.B161.jar!/conf/framework.dsf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-adapter-dsf-6.1.51.B120/WEB-INF/lib/com.huawei.csc.usf.adapter.dsf-6.1.51.B120.jar!/conf/dsf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-adapter-dsf-6.1.51.B120/WEB-INF/lib/com.huawei.csc.usf.adapter.dsf-6.1.51.B120.jar!/conf/framework.dsf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-framework-6.1.00.B161/WEB-INF/lib/com.huawei.csc.usf.framework-6.1.00.B161.jar!/conf/framework.usf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/appmw-usf-framework-6.1.51.B120/WEB-INF/lib/com.huawei.csc.usf.framework-6.1.51.B120.jar!/conf/framework.usf.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.jcrm.pt.brf_base-0.0.1-SNAPSHOT/WEB-INF/lib/com.huawei.bpm.integration.bme-6.1.00.B161.jar!/conf/bpm.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.jcrm.pt.brf_base-0.0.1-V6R1C51-SNAPSHOT/WEB-INF/lib/com.huawei.bpm.integration.bme-6.1.51.B120.jar!/conf/bpm.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.cloudcrm.jcrm.common-0.0.1-SNAPSHOT/WEB-INF/lib/com.huawei.cloudcrm.jcrm.common-0.0.1-SNAPSHOT.jar!/conf/uconfig/com.huawei.jcrm.pt.base.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.cloudcrm.jcrm.common-0.0.1-V6R1C51-SNAPSHOT/WEB-INF/lib/com.huawei.cloudcrm.jcrm.common-0.0.1-V6R1C51-SNAPSHOT.jar!/conf/uconfig/com.huawei.jcrm.pt.base.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.cloudcrm.jcrm.frame-0.0.1-SNAPSHOT/WEB-INF/lib/com.huawei.cloudcrm.jcrm.frame-0.0.1-SNAPSHOT.jar!/conf/uconfig/com.huawei.jcrm.base.uconfig-policy.xml, jar:file:/D:/JCRM/OpenAS_6130_20240429/webapps/com.huawei.jcrm.srv.jcrm.cars/com.huawei.cloudcrm.jcrm.frame-0.0.1-V6R1C51-SNAPSHOT/WEB-INF/lib/com.huawei.cloudcrm.jcrm.frame-0.0.1-V6R1C51-SNAPSHOT.jar!/conf/uconfig/com.huawei.jcrm.base.uconfig-policy.xml failed. <-- cvc-complex-type.2.4.a: Invalid content was found starting with element 'default'. One of '{extension, additional, merge-template}' is expected. at com.huawei.bme.commons.uconfig.UPolicyBuilder.parsePolicies(UPolicyBuilder.java:296) at com.huawei.bme.commons.uconfig.UPolicyBuilder.getPolicies(UPolicyBuilder.java:102) at com.huawei.bme.commons.uconfig.PolicyDigest.getPolicies(PolicyDigest.java:335) at com.huawei.bme.commons.uconfig.UConfigurationFactory.getPolicies(UConfigurationFactory.java:554) at com.huawei.bme.commons.uconfig.UConfigurationFactory.getPolicy(UConfigurationFactory.java:468) at com.huawei.bme.commons.uconfig.UConfigurationFactory.getDocumentConfiguration(UConfigurationFactory.java:1285) at com.huawei.bme.commons.uconfig.UConfigurationFactory.getDocumentConfiguration(UConfigurationFactory.java:1230) at com.huawei.bme.commons.uconfig.UConfigurationFactory.getDocumentConfiguration(UConfigurationFactory.java:1213) at com.huawei.bme.commons.uconfig.UConfigHelper.getDefaultDocumentConfiguration(UConfigHelper.java:105) at com.huawei.bme.container.control.config.ConfigReader.getInitConfigData(ConfigReader.java:65) at com.huawei.bme.container.control.policy.AbstractFixturePolicy.<init>(AbstractFixturePolicy.java:70) at com.huawei.bme.container.control.policy.SimpleFixturePolicy.<init>(SimpleFixturePolicy.java:27) at com.huawei.bme.container.control.ContainerControl.<init>(ContainerControl.java:38) at com.huawei.bme.container.control.ContainerContextLoaderListener.createController(ContainerContextLoaderListener.java:214) at com.huawei.bme.container.control.ContainerContextLoaderListener.contextInitialized(ContainerContextLoaderListener.java:108) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5126) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5656) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1700) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1690) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.xml.sax.SAXParseException; lineNumber: 329; columnNumber: 52; cvc-complex-type.2.4.a: Invalid content was found starting with element 'default'. One of '{extension, additional, merge-template}' is expected. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1765) at com.huawei.bme.commons.uconfig.UPolicyBuilder.parsePolicies(UPolicyBuilder.java:278) ... 23 more Closing business container... Closing container context... Container context is closed successfully! ******************************************************* * * * Business container is closed successfully! * * * *******************************************************
08-27
### SLF4J Multiple Bindings Warning 的解决 当项目中出现 `SLF4J: Class path contains multiple SLF4J bindings` 警告时,表示类路径中存在多个 SLF4J 实现绑定。SLF4J 是一个日志门面,允许开发者在运行时选择具体的日志实现(如 Logback、Log4j、Simple Logger 等)。当存在多个绑定时,SLF4J 会随机选择其中一个作为实际绑定,这可能导致日志行为不可预测。 解决此类问题的关键在于**排除多余的 SLF4J 绑定依赖**,确保项目中只保留一个 SLF4J 实现。具体操作如下: 1. **使用 Maven Helper 插件分析依赖**:在 IntelliJ IDEA 中安装 Maven Helper 插件,通过 Dependency Analyzer 功能查看哪些依赖引入了 SLF4J 的绑定。 2. **排除冲突依赖**:在 `pom.xml` 中通过 `<exclusion>` 标签移除不必要的 SLF4J 实现依赖。例如,若项目使用 Log4j2,应排除 Logback 或 Simple Logger 的绑定: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> ``` 3. **验证依赖更新**:刷新 Maven 依赖后,重新构建项目,确保 SLF4J 绑定冲突已被解决。 ### uconfig-policy.xml 文件解析错误的解决 `com.huawei.bme.commons.uconfig.UConfigurationException: Parsing uconfig-policy.xml failed with error 'Invalid content was found starting with element default'` 错误表明在解析 `uconfig-policy.xml` 文件时,XML 解析器遇到了不符合预期的结构或内容。 此问题的常见原因包括: - **XML 文件格式错误**:文件中可能存在语法错误,如标签未闭合、属性格式不正确等。 - **XML Schema 校验失败**:文件内容不符合定义的 XSD 模式,例如使用了未定义的元素或属性。 - **默认值配置错误**:错误信息中提到的 `default` 元素可能未被正确识别,可能是因为其位置或上下文不符合模式要求。 解决步骤如下: 1. **检查 XML 文件结构**:使用 XML 校验工具(如 XMLSpy 或在线 XML 校验器)检查 `uconfig-policy.xml` 是否符合 XML 语法规范。 2. **验证 XML 模式(XSD)**:确认 `uconfig-policy.xml` 是否引用了正确的 XSD 文件,并确保该文件存在于类路径中。例如: ```xml <Policy xmlns="http://www.huawei.com/bme/commons/uconfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.huawei.com/bme/commons/uconfig uconfig-policy.xsd"> <!-- 配置内容 --> </Policy> ``` 3. **修正 `default` 元素的使用**:检查 `default` 元素是否在正确的上下文中使用,确保其符合 XSD 定义。例如,若 `default` 应该作为某个父元素的子节点,确保其位置正确。 4. **启用调试日志**:在配置解析过程中启用详细的日志输出,帮助定位具体的解析错误。可以通过配置日志框架(如 Log4j2)来输出调试信息: ```xml <Loggers> <Logger name="com.huawei.bme.commons.uconfig" level="DEBUG"/> <Root level="INFO"> <AppenderRef ref="Console"/> </Root> </Loggers> ``` 5. **测试配置文件**:在独立环境中运行配置解析代码,验证 `uconfig-policy.xml` 是否能够被正确加载和解析。 ###
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值