1 solutions
-
0
C++ :
#include<stdio.h> int main() { int t;scanf("%d",&t); while(t--) { long long all=0,max=0; long l,n;scanf("%ld%ld",&l,&n); for (int i=0;i<n;i++) { long as;scanf("%ld",&as); if (as>l-as) {if (all<(l-as)) all=l-as; if (max<(as)) max=as;} else {if (all<as) all=as; if (max<l-as) max=l-as;} } printf("%lld %lld\n",all,max); } return 0; }
- 1
Information
- ID
- 17255
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By