Submission #1111255

#TimeUsernameProblemLanguageResultExecution timeMemory
1111255StefanSebezRoom Temperature (JOI24_ho_t1)C++14
100 / 100
94 ms7232 KiB
#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 int main(){ int n,T;scanf("%i%i",&n,&T); int a[n+10];for(int i=1;i<=n;i++) scanf("%i",&a[i]),a[i]%=T; sort(a+1,a+n+1); int res=a[n]-a[1]; for(int i=2;i<=n;i++) res=min(res,T-(a[i]-a[i-1])); printf("%i\n",res+1>>1); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:14:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   14 |     printf("%i\n",res+1>>1);
      |                   ~~~^~
Main.cpp:9:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     int n,T;scanf("%i%i",&n,&T);
      |             ~~~~~^~~~~~~~~~~~~~
Main.cpp:10:44: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     int a[n+10];for(int i=1;i<=n;i++) scanf("%i",&a[i]),a[i]%=T;
      |                                       ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...