1 /*1002*/2#include <iostream>3#include <string>4#include <map>5#include <queue>6#include <Set>7#include <stack>8#include <vector>9#include <algorithm>Ten#include <cstdio> One#include <cmath> A#include <ctime> -#include <cstring> -#include <climits> the#include <cctype> - using namespacestd; - - Const intMAXN = 1e3+5; + - intA[MAXN], DIS[MAXN]; + intN, M; A at intMain () { - intI, J, K; - intMX, q; - intL1, L2; - intx, Y, Z, S, tmp; - __int64 ans; in intL, R; - to #ifndef Online_judge +Freopen ("data.in","R", stdin); -Freopen ("Data.out","W", stdout); the #endif * $ while(SCANF ("%d%d", &n, &m)! =EOF) {Panax NotoginsengR =-1; -L = n+1; theAns =0; + for(i=1; i<=m; ++i) { Ascanf"%d", &a[i]); theL =min (a[i], L); +R =Max (A[i], R); - } $ if(l==1|| r==N) { $s = max (L-1, N-R); - for(z=1; z<n; ++z) { - if(Z >= Sz) the Break; -TMP = SZ;WuyiL = (tmp-z)/2+1; theR = (tmp+z-1)/2; -Ans + = (r-l+1); Wu } -printf"%i64d\n", ans); About Continue; $ } -L1 = L1; -L2 = NR; -z =L1; A for(x=1; x<l2; ++x) { +y = l2-x; the if(x+y>z && y+z>x && z+x>y) -++ans; $ } thez =L2; the for(x=1; x<l1; ++x) { they = l1-x; the if(x+y>z && y+z>x && z+x>y) -++ans; in } theprintf"%i64d\n", ans); the } About the #ifndef Online_judge theprintf"%d\n", (int) clock ()); the #endif + - return 0; the}
"Hdoj" 5203 Rikka with wood sticks