Submission #2940460
Source Code Expand
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
/*
8/3/2018
19:50-20:20, 21:30-
*/
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
const int MAX_N=1e5+1;
int N;
LL A[MAX_N];
LL T;
void solve() {
map<LL,int> D;
LL btm=A[0];
FOR(i,1,N) {
if(A[i]<btm) btm=A[i];
else if(A[i]>btm) {
D[-(A[i]-btm)]++;
}
}
cout<<D.begin()->second<<endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>N>>T;
REP(i,N) cin>>A[i];
solve();
return 0;
}
Submission Info
Submission Time |
|
Task |
D - An Invisible Hand |
User |
kumalimak |
Language |
C++14 (Clang 3.8.0) |
Score |
400 |
Code Size |
2211 Byte |
Status |
AC |
Exec Time |
139 ms |
Memory |
7296 KB |
Judge Result
Set Name |
sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
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 |
105 ms |
1024 KB |
large_02.txt |
AC |
106 ms |
7296 KB |
random_01.txt |
AC |
138 ms |
7296 KB |
random_02.txt |
AC |
139 ms |
7296 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 |
138 ms |
7296 KB |
spec_02.txt |
AC |
137 ms |
7296 KB |
spec_03.txt |
AC |
135 ms |
6912 KB |
spec_04.txt |
AC |
134 ms |
6912 KB |
spec_05.txt |
AC |
130 ms |
5888 KB |
spec_06.txt |
AC |
130 ms |
4736 KB |