# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1111248 | 2024-11-11T20:44:00 Z | StefanSebez | Room Temperature (JOI24_ho_t1) | C++14 | 2 ms | 592 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define ll long long #define ld long double const int inf=1e9; int n,T; int Dist(int x,int y){ while(x<0)x+=T;x%=T; while(y<0)y+=T;y%=T; return min(abs(x-y),T-abs(x-y)); } int main(){ scanf("%i%i",&n,&T); int a[2*n+10];for(int i=1;i<=n;i++) scanf("%i",&a[i]),a[i]%=T; sort(a+1,a+n+1); for(int i=1;i<=n;i++) a[i+n]=a[i]; //for(int i=1;i<=n;i++) printf("%i ",a[i]);printf("\n"); int res=inf; for(int i=1,j=2;i<=n;i++){ while(j<2*n&&Dist(a[i],a[j])<=Dist(a[i],a[j+1]))j++; //printf("%i: %i\n",a[i],a[j]); res=min(res,(Dist(a[i],a[j])+1)/2); } printf("%i\n",res); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 592 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 504 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 592 KB | Output is correct |
14 | Correct | 2 ms | 336 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 1 ms | 336 KB | Output is correct |
17 | Correct | 1 ms | 452 KB | Output is correct |
18 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 504 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 592 KB | Output is correct |
14 | Correct | 2 ms | 336 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 1 ms | 336 KB | Output is correct |
17 | Correct | 1 ms | 452 KB | Output is correct |
18 | Correct | 1 ms | 336 KB | Output is correct |
19 | Correct | 1 ms | 336 KB | Output is correct |
20 | Correct | 1 ms | 336 KB | Output is correct |
21 | Correct | 1 ms | 336 KB | Output is correct |
22 | Correct | 1 ms | 336 KB | Output is correct |
23 | Correct | 1 ms | 588 KB | Output is correct |
24 | Correct | 1 ms | 336 KB | Output is correct |
25 | Incorrect | 1 ms | 336 KB | Output isn't correct |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 592 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 1 ms | 336 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 1 ms | 336 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 1 ms | 336 KB | Output is correct |
19 | Correct | 1 ms | 504 KB | Output is correct |
20 | Correct | 1 ms | 336 KB | Output is correct |
21 | Correct | 1 ms | 504 KB | Output is correct |
22 | Correct | 1 ms | 336 KB | Output is correct |
23 | Correct | 1 ms | 336 KB | Output is correct |
24 | Correct | 1 ms | 592 KB | Output is correct |
25 | Correct | 2 ms | 336 KB | Output is correct |
26 | Correct | 1 ms | 336 KB | Output is correct |
27 | Correct | 1 ms | 336 KB | Output is correct |
28 | Correct | 1 ms | 452 KB | Output is correct |
29 | Correct | 1 ms | 336 KB | Output is correct |
30 | Correct | 1 ms | 336 KB | Output is correct |
31 | Correct | 1 ms | 336 KB | Output is correct |
32 | Correct | 1 ms | 336 KB | Output is correct |
33 | Correct | 1 ms | 336 KB | Output is correct |
34 | Correct | 1 ms | 588 KB | Output is correct |
35 | Correct | 1 ms | 336 KB | Output is correct |
36 | Incorrect | 1 ms | 336 KB | Output isn't correct |
37 | Halted | 0 ms | 0 KB | - |