Submission #857444

#TimeUsernameProblemLanguageResultExecution timeMemory
857444CMJA Huge Tower (CEOI10_tower)C++98
100 / 100
94 ms3600 KiB
#include <algorithm> #include <stdio.h> int b[1000000];int main(){int n,d; scanf("%d %d\n",&n,&d);long long sol=1;for(int i=0;i<n;i++)scanf("%d",b+i);std::sort(b,b+n);for(int l=0,r=0;l<n;l++){while((r<n)&&(b[r]<=b[l]+d))r++;sol*=(r-l);sol%=1000000009;}printf("%d\n",sol);}

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:3:222: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
    3 | int b[1000000];int main(){int n,d; scanf("%d %d\n",&n,&d);long long sol=1;for(int i=0;i<n;i++)scanf("%d",b+i);std::sort(b,b+n);for(int l=0,r=0;l<n;l++){while((r<n)&&(b[r]<=b[l]+d))r++;sol*=(r-l);sol%=1000000009;}printf("%d\n",sol);}
      |                                                                                                                                                                                                                             ~^    ~~~
      |                                                                                                                                                                                                                              |    |
      |                                                                                                                                                                                                                              int  long long int
      |                                                                                                                                                                                                                             %lld
tower.cpp:3:41: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | int b[1000000];int main(){int n,d; scanf("%d %d\n",&n,&d);long long sol=1;for(int i=0;i<n;i++)scanf("%d",b+i);std::sort(b,b+n);for(int l=0,r=0;l<n;l++){while((r<n)&&(b[r]<=b[l]+d))r++;sol*=(r-l);sol%=1000000009;}printf("%d\n",sol);}
      |                                    ~~~~~^~~~~~~~~~~~~~~~~
tower.cpp:3:100: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | int b[1000000];int main(){int n,d; scanf("%d %d\n",&n,&d);long long sol=1;for(int i=0;i<n;i++)scanf("%d",b+i);std::sort(b,b+n);for(int l=0,r=0;l<n;l++){while((r<n)&&(b[r]<=b[l]+d))r++;sol*=(r-l);sol%=1000000009;}printf("%d\n",sol);}
      |                                                                                               ~~~~~^~~~~~~~~~
#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...
#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...
#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...
#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...