Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:事实证明:本题用longlong会wa,要用unsignedlongIn Reply To:事实证明:本题用longlong会wa,要用unsignedlong Posted by:LittleKid at 2007-09-28 15:34:43 并没有这回事啊 #include<stack> #include<bitset> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> using namespace std; signed main(void) { int n; long long ans = 0; stack< pair<int, int> > stk; scanf("%d", &n); for (int i = 1; i <= n + 1; i++) { int h = 0x3f3f3f3f; if (i <= n)scanf("%d", &h); while (stk.size() && stk.top().first <= h) { ans += i - stk.top().second - 1; stk.pop(); } stk.push(make_pair(h, i)); } printf("%lld\n", ans); // system("pause"); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator