Submission #2101679
Source Code Expand
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
#define ALL(obj) (obj).begin(),(obj).end()
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
cin>>head;
CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
#define pb(a) push_back(a)
#define mp make_pair
int main(){
CIN(n,t);V a(n);VECCIN(a);
//最大利益の計算
int minnum = INF;
int maxdif = -INF;
REP(i,n){
minnum=min(minnum,a[i]);
maxdif = max(maxdif,a[i]-minnum);
}
ll profits = 1LL * maxdif * t / 2;
vector<P> vec;
P minnum2 = mp(INF,-1);
REP(i,n){
if(minnum2.first > a[i]){
minnum2.first = a[i];
minnum2.second = i;
}
if(a[i]-minnum2.first == maxdif)vec.pb(mp(minnum2.second,i));
}
// FOREACH(xx,vec)cout<<xx.first<<" "<<xx.second<<endl;
COUT(vec.size());
return 0;
}
Submission Info
Submission Time |
|
Task |
D - An Invisible Hand |
User |
shibh308 |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
2328 Byte |
Status |
AC |
Exec Time |
43 ms |
Memory |
1276 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 |
41 ms |
1276 KB |
large_02.txt |
AC |
29 ms |
640 KB |
random_01.txt |
AC |
43 ms |
640 KB |
random_02.txt |
AC |
40 ms |
640 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 |
640 KB |
spec_02.txt |
AC |
41 ms |
640 KB |
spec_03.txt |
AC |
41 ms |
640 KB |
spec_04.txt |
AC |
43 ms |
640 KB |
spec_05.txt |
AC |
41 ms |
896 KB |
spec_06.txt |
AC |
41 ms |
1024 KB |