首页 > 代码库 > POJ 1852 - Ants

POJ 1852 - Ants

题意

思路

总结

竟然因为用cin cout超时???EXCUSE ME???

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 #include <cstring>
 5 using namespace std;
 6 const int INF = 0x3f3f3f3f;
 7 const int maxn = 1000005;
 8 int T, n, m;
 9 int s[maxn];
10 int main()
11 {
12     //freopen("in.txt", "r", stdin);
13     scanf("%d", &T);
14     while(T--) {
15         memset(s, 0, sizeof s);
16         scanf("%d %d", &n, &m);
17         int Min = 0, Max = 0;
18         for(int i = 0; i < m; i++) {
19             scanf("%d", &s[i]);
20             int k = min(s[i], n - s[i]);
21             Min = max(Min, k);
22             Max = max(Max, n - k);
23         }
24         printf("%d %d\n", Min, Max);
25     }
26 
27     return 0 ;
28 }

 

POJ 1852 - Ants