| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1248660 | Bui_Quoc_Cuong | Room Temperature (JOI24_ho_t1) | C++20 | 1 ms | 328 KiB | 
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define FOR(i, a, b) for (int i = a; i <= (int)b; i++)
#define FORD(i, a, b) for (int i = a; i >= (int)b; i--)
#define MASK(i) (1LL << (i))
#define BIT(S, i) (((S) >> (i)) & 1)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
const int N = 5e5 + 5;
int n, T;
void init(){
	cin >> n >> T;
}
int a[N], pre[N];
void process(){
	vector <int> circle;
	for(int i = 1; i <= n; i++){
		int x; cin >> x;
		a[x % T]++;
		circle.push_back(x % T);
	}
	sort(all(circle)); circle.resize(unique(all(circle)) - circle.begin());
	int m = circle.size();
	vector <int> cur_cir = circle;
	for(int i = 0; i <= m - 1; i++) circle.push_back(circle[i]);
	int ans = 2e9;
	for(int i = 0; i < m; i++){
		int l = i, r = i + m - 1;
		if(circle[l] <= circle[r]){
			ans = min(ans, circle[r] - circle[l] + 1);
		} else{
			ans = min(ans, (circle[r] + T - circle[l] + 1));
		}
	}	
	cout << ans / 2;
}
signed main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);   
    #define taskname "kieuoanh"
    if(fopen(taskname".inp", "r")){ 
        freopen(taskname".inp", "r", stdin); 
        freopen(taskname".out", "w", stdout);
    }
    init();
    process();
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
