Service Lane

Service Lane

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int N,T,tem;
    cin>>N>>T;
    int a[N-1];
    
    for(int i = 0;i < N;i++)
        {
            cin>>tem;
            if(tem>=1 && tem <=3)
            a[i] = tem;
            
        }
        
    while(T--)
        {
        int i,j,m;
        int min;
        cin>>i>>j;
        if(i < j && i >= 0 && j < N && j-i >=1)
            {
            min = a[i];
            for(m = i+1;m <= j;m++)
                {
                if(a[m] < min)
                    min = a[m];
                }
            cout<<min<<endl;
            }
        else
            cout<<"input error!"<<endl;
              
        
    }   
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    return 0;
}

时间: 2024-08-07 07:40:30

Service Lane的相关文章

【HackerRank】Service Lane

Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks. Luckily, a service lane runs parallel to the highway. The length of the

Python库 - Albumentations 图片数据增强库

Python图像处理库 - Albumentations,可用于深度学习中网络训练时的图片数据增强. Albumentations 图像数据增强库特点: 基于高度优化的 OpenCV 库实现图像快速数据增强. 针对不同图像任务,如分割,检测等,超级简单的 API 接口. 易于个性化定制. 易于添加到其它框架,比如 PyTorch. 1. Albumentations 的 pip 安装 sudo pip install albumentations # 或 sudo pip install -U

mysqld服务启动失败, Failed to restart mysqld.service: Unit not found.

-bash-4.2# service mysqld restart Redirecting to /bin/systemctl restart mysqld.serviceFailed to restart mysqld.service: Unit not found. 并不存在 mysqld 的服务, -bash-4.2# -bash-4.2# chkconfig -list -list: unknown option -bash-4.2# chkconfig --list Note: Thi

Spring Cloud ZooKeeper集成Feign的坑2,服务调用了一次后第二次调用就变成了500,错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.n

错误如下: 2017-09-19 15:05:24.659 INFO 9986 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]56528192: startup date [Tue Sep 19 15:05:24 CST 2017]; root of context hierarchy 2017-09-19 15:05:24.858 INFO 9986 --

开发者为何对Service Fabric爱不释手?值得关注!

有了它,人人都可开发高可用高伸缩应用.今天小编就为大家介绍一款开发者的"利器"--Service Fabric . 在介绍它之前,先来了解一下它的背景. Service Fabric 是一款应用程序平台,可用于构建基于微服务的应用程序.其核心部分是一个分布式系统平台,用于构建可扩展的可靠应用.在便于封装可部署代码的同时,还内置了微服务最佳实践案例. 快速上市:通过 Service Fabric,开发人员可将重点放在创建可为应用程序增加商业价值的功能上,从而避免了为在基础结构中处理可靠性

在GlassFish应用服务器上创建并运行你的第一个Restful Web Service【翻译】

前言 本人一直开发Android应用,目前Android就业形势恶劣,甚至会一路下滑,因此决定学习服务器开发.采用的语言是java,IDE是Intellij,在下载Intellij的同时看到官网很多优秀的guide文章,于是按照guide成功完成了一个RESTful的demo.官方文档非常简洁,给我带来了很大的帮助,于是翻译之,希望对其他不愿意看原文的人有所帮助.由于水平有限,读者发现错误请指正,谢谢. 原文地址: https://www.jetbrains.com/help/idea/2016

服务 Service【经典案例】

2017-1-19 Activity public class MainActivity extends ListActivity {     private boolean flag;//线程结束条件     public static final String ACTION_TEST_SERVICE = "com.bqt.service.TEST_SERVICE";     private MyServiceConnection conn;     private IBinderI

Spring quartz定时任务service注入问题

今天想单元测试一下spring中的quartz定时任务,一顿折腾,到最后总是发现job类里注入的service为null.一开始还以为spring的配置问题,各种找原因,最后还是确定是没有注入. 就去网上搜搜吧.也找出来一些眉目.简单的理解这个原因是job是在quartz中实例化出来的,不受spring的管理.所以就导致注入不进去了.参考这个文章 http://www.tuicool.com/articles/Qjyamu 找着试试的态度,就按照文章里说的.new一个类 public class

The SQL Server Service Broker for the current database is not enabled

把一个数据恢复至另一个服务器上,出现了一个异常: The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.  Please enable the Service Broker for this database if you wish to use notifications. 截图如下: 解决方法: 参