Submission #374734

#TimeUsernameProblemLanguageResultExecution timeMemory
374734wzyA Huge Tower (CEOI10_tower)C++11
30 / 100
134 ms13676 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = (ll) 1e9 + 9; int32_t main(){ int n , d , j = 1; scanf("%d%d" , &n , &d); vector<int> v(n+1); vector<long long> dp(n+1); dp[0] = 1; for(int i = 1; i <= n; i ++){ scanf("%d" , &v[i]); } sort(v.begin() + 1 , v.end()); dp[1] = 1; for(int i = 2; i <= n; i ++){ while(v[i] > v[j] + d) j++; dp[i] = dp[i-1] * (i-j+1); } printf("%lld\n" , dp[n]); }

Compilation message (stderr)

tower.cpp: In function 'int32_t main()':
tower.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%d%d" , &n , &d);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
tower.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |   scanf("%d" , &v[i]);
      |   ~~~~~^~~~~~~~~~~~~~
#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...