# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1173283 | SmuggingSpun | Room Temperature (JOI24_ho_t1) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
template<class T>void minimize(T& a, T b){
if(a > b){
a = b;
}
}
const int lim = 5e5 + 5;
int n, t, a[lim];
namespace sub1{
void solve(){
int d = abs(a[1] % t - a[2] % t);
minimize(d, t - d);
cout << ((d + 1) >> 1);
}
}
namespace sub23{
void solve(){
if(t == 1){
return void(cout << 0);
}
for(int i = 2; i <= n; i++){
if((a[i] & 1) != (a[1] & 1)){
return void(cout << 1);
}
}
cout << 0;
}
}
namespace sub4{
void solve(){
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
cin >> n >> t;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
if(n == 2){
sub1::solve();
}
else if(t <= 2){
sub23::solve();
}
else{
sub4::solve();
}
}
Compilation message (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... |