Submission #146884

# Submission time Handle Problem Language Result Execution time Memory
146884 2019-08-26T13:23:44 Z 44442 Pismo (COCI18_pismo) C++11
70 / 70
20 ms 1912 KB
#include <bits/stdc++.h>
using namespace std;
long long n,a[100004],ok=0x7fffffffff;
int main (){
     scanf("%d",&n);
     for(int i=0;i<n;i++){
         scanf("%d",&a[i]);
	 }
	 for(int i=1;i<n;i++){
	 	 ok=min(ok,abs(a[i]-a[i-1]));
	 }
	 printf("%d",ok);
return 0;
}

Compilation message

pismo.cpp: In function 'int main()':
pismo.cpp:5:19: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
      scanf("%d",&n);
                 ~~^
pismo.cpp:7:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
          scanf("%d",&a[i]);
                     ~~~~~^
pismo.cpp:12:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   printf("%d",ok);
                 ^
pismo.cpp:5:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d",&n);
      ~~~~~^~~~~~~~~
pismo.cpp:7:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
          scanf("%d",&a[i]);
          ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 380 KB Output is correct
5 Correct 20 ms 1912 KB Output is correct
6 Correct 20 ms 1912 KB Output is correct
7 Correct 20 ms 1912 KB Output is correct