提出 #73162493


ソースコード 拡げる

//I often recall the past. 
//Life is captured in an instant in my mind. I cut, fold and curl the time behind me, and twist it into the white clouds in the sky. 
//There are distinctions among clouds: cumulus clouds are thick and heavy, while cirrus clouds are ethereal and light. The scenes that shock me in life remain unforgettable for a lifetime once they pass through my mind, while more ordinary and common memories leave only a few remnants after being washed away by time. Recalling the past is like entering a dream; if it is too clear, it cannot please my imagination, and if it is too vague, it will fall into nothingness. Only the mountains and waters in the mist, the woman behind the veil, that just-right haziness, can satisfy my strict demands for beauty. 
//Memories always wrap me up in the yellowed pages unexpectedly. Friends who parted and reunited, streets that were demolished and rebuilt, all these clues help me set off from a specific moment and travel upstream along the river of time. The past days can never come back, and I am just a passer-by. But I still long to leave some leisure time during each journey of reminiscence, to linger before a scene, to look back at my past self in the haze of time, and to feel as much sweetness as possible. The good times once flowed through my body, and I am content. 
//The past has solidified. I move forward with my memories, but I often neglect to keep them well, and the memories themselves are changing their forms. This brings some challenges to my journey of reminiscence. 
//Where should I stop? I ask myself.
#include<bits/stdc++.h>
#define fre(x) \
	freopen(x".in","r",stdin); \
	freopen(x".out","w",stdout)
#define int long long
#define il inline
namespace IO {
	template <typename T>
	void read(T &x)
	{
		x=0;
		T flag=1;
		char ch=getchar();
		while(ch<'0' or ch>'9')
		{
			if(ch=='-')
				flag=-flag;
			ch=getchar();
		}
		while(ch>='0' and ch<='9')
		{
			x=(x<<3)+(x<<1)+(ch-'0');
			ch=getchar();
		}
		x*=flag;
	}
	template <typename T>
	void print(T x)
	{
		if(x<0)
			putchar('-'),x=-x;
		int W[114],cnt=0;
		do
		{
			W[++cnt]=x%10;
			x/=10;
		}while(x);
		for(int i=cnt;i>=1;i--)
			putchar(W[i]+'0');
	}
}
using namespace IO;
using namespace std;

const int MOD=1e9+7;

il int add(int A,int B) {return A+B>=MOD?A+B-MOD:A+B;}
il int sub(int A,int B) {return A-B<0?A-B+MOD:A-B;}
il int mul(int A,int B) {return 1ll*A*B>=MOD?1ll*A*B%MOD:A*B;}

il void Add(int &A,int B) {A+B>=MOD?A=A+B-MOD:A+=B;}
il void Sub(int &A,int B) {A-B<0?A=A-B+MOD:A-=B;}
il void Mul(int &A,int B) {1ll*A*B>=MOD?A=1ll*A*B%MOD:A*=B;}

il int qpow(int A,int B)
{
	int res=1;
	
	while(B)
	{
		if(B&1)
			Mul(res,A);
		Mul(A,A);
		B>>=1;
	}
	
	return res;
}

il int inv(int A) {return qpow(A,MOD-2);}

const int MAXN = 1e6 + 7;

int n, l, r;

struct node {
	int id, val;
} p[MAXN];

void work()
{
    int maxx = INT_MIN, minx = INT_MAX, ans = 0;

    scanf("%lld", &n);

	scanf("%lld %lld", &l, &r);

	for(int i = 1; i <= n; i++)
	{
		scanf("%lld", &p[i].val);

        maxx = max(maxx, p[i].val);
        minx = min(minx, p[i].val);

        if(p[i].val >= l and p[i].val <= r)
        {
            if(p[i].val > p[ans].val or !ans)
                ans = i;
        }
	}

    if(maxx < l or minx > r)
        puts("-1");
    else
        printf("%lld", ans);

    return ;
}

signed main()
{
	int T = 1;
	
//	scanf("%lld",&T);
	
	while(T--)
		work();
	
	return 0;
}

提出情報

提出日時
問題 B - 試験の合格者
ユーザ huhaoming
言語 C++23 (GCC 15.2.0)
得点 233
コード長 3557 Byte
結果 AC
実行時間 10 ms
メモリ 7096 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 233 / 233
結果
AC × 3
AC × 78
セット名 テストケース
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt, in65.txt, in66.txt, in67.txt, in68.txt, in69.txt, in70.txt, in71.txt, in72.txt, in73.txt, in74.txt, in75.txt
ケース名 結果 実行時間 メモリ
in01.txt AC 1 ms 3796 KiB
in02.txt AC 1 ms 3768 KiB
in03.txt AC 1 ms 3624 KiB
in04.txt AC 1 ms 3816 KiB
in05.txt AC 1 ms 3828 KiB
in06.txt AC 1 ms 3792 KiB
in07.txt AC 1 ms 3792 KiB
in08.txt AC 9 ms 7028 KiB
in09.txt AC 9 ms 6996 KiB
in10.txt AC 10 ms 6912 KiB
in11.txt AC 10 ms 6992 KiB
in12.txt AC 10 ms 6984 KiB
in13.txt AC 9 ms 7096 KiB
in14.txt AC 10 ms 6984 KiB
in15.txt AC 9 ms 6968 KiB
in16.txt AC 9 ms 7096 KiB
in17.txt AC 9 ms 6992 KiB
in18.txt AC 1 ms 3764 KiB
in19.txt AC 10 ms 7020 KiB
in20.txt AC 10 ms 7048 KiB
in21.txt AC 9 ms 7020 KiB
in22.txt AC 9 ms 7048 KiB
in23.txt AC 9 ms 6984 KiB
in24.txt AC 9 ms 6964 KiB
in25.txt AC 9 ms 7096 KiB
in26.txt AC 9 ms 7048 KiB
in27.txt AC 9 ms 6964 KiB
in28.txt AC 9 ms 6992 KiB
in29.txt AC 9 ms 6956 KiB
in30.txt AC 1 ms 3784 KiB
in31.txt AC 1 ms 3812 KiB
in32.txt AC 1 ms 3780 KiB
in33.txt AC 1 ms 3724 KiB
in34.txt AC 1 ms 3780 KiB
in35.txt AC 1 ms 3888 KiB
in36.txt AC 1 ms 3780 KiB
in37.txt AC 1 ms 3728 KiB
in38.txt AC 1 ms 3724 KiB
in39.txt AC 1 ms 3664 KiB
in40.txt AC 1 ms 3780 KiB
in41.txt AC 1 ms 3792 KiB
in42.txt AC 1 ms 3764 KiB
in43.txt AC 1 ms 3820 KiB
in44.txt AC 10 ms 6872 KiB
in45.txt AC 9 ms 7028 KiB
in46.txt AC 10 ms 6968 KiB
in47.txt AC 10 ms 6980 KiB
in48.txt AC 9 ms 7024 KiB
in49.txt AC 10 ms 7048 KiB
in50.txt AC 10 ms 6980 KiB
in51.txt AC 8 ms 6144 KiB
in52.txt AC 9 ms 6972 KiB
in53.txt AC 9 ms 7048 KiB
in54.txt AC 10 ms 6856 KiB
in55.txt AC 9 ms 7048 KiB
in56.txt AC 10 ms 6996 KiB
in57.txt AC 10 ms 6924 KiB
in58.txt AC 1 ms 3756 KiB
in59.txt AC 1 ms 3820 KiB
in60.txt AC 1 ms 3792 KiB
in61.txt AC 1 ms 3780 KiB
in62.txt AC 1 ms 3820 KiB
in63.txt AC 1 ms 3824 KiB
in64.txt AC 1 ms 3764 KiB
in65.txt AC 1 ms 3672 KiB
in66.txt AC 1 ms 3704 KiB
in67.txt AC 1 ms 3784 KiB
in68.txt AC 1 ms 3824 KiB
in69.txt AC 1 ms 3784 KiB
in70.txt AC 1 ms 3824 KiB
in71.txt AC 1 ms 3820 KiB
in72.txt AC 1 ms 3824 KiB
in73.txt AC 1 ms 3656 KiB
in74.txt AC 1 ms 3756 KiB
in75.txt AC 1 ms 3656 KiB
sample01.txt AC 1 ms 3656 KiB
sample02.txt AC 1 ms 3712 KiB
sample03.txt AC 1 ms 3672 KiB