Submission #2115247


Source Code Expand

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int main(){
	ll n,t; cin >> n >> t; ll a[100010];
	REP(i,0,n) cin >> a[i];
	
	ll ma = 0, MA = 0, c = 0;
	RREP(i, n - 1, 0){
		ll pos = t / 2 * ma - t / 2 * a[i];
		
		if(MA < pos) MA = pos, c = 1;
		else if(MA == pos) c++;
		ma = max(ma, a[i]);
	}
	
	cout << c << endl;
	return 0;
}

Submission Info

Submission Time
Task D - An Invisible Hand
User ecasdqina
Language C++14 (GCC 5.4.1)
Score 400
Code Size 704 Byte
Status AC
Exec Time 41 ms
Memory 1024 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 15
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All large_01.txt, large_02.txt, random_01.txt, random_02.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, spec_01.txt, spec_02.txt, spec_03.txt, spec_04.txt, spec_05.txt, spec_06.txt
Case Name Status Exec Time Memory
large_01.txt AC 40 ms 1024 KB
large_02.txt AC 29 ms 1024 KB
random_01.txt AC 40 ms 1024 KB
random_02.txt AC 40 ms 1024 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
small_01.txt AC 1 ms 256 KB
small_02.txt AC 1 ms 256 KB
spec_01.txt AC 41 ms 1024 KB
spec_02.txt AC 41 ms 1024 KB
spec_03.txt AC 41 ms 1024 KB
spec_04.txt AC 40 ms 1024 KB
spec_05.txt AC 40 ms 1024 KB
spec_06.txt AC 41 ms 1024 KB