Submission #859835

#TimeUsernameProblemLanguageResultExecution timeMemory
859835LalicA Huge Tower (CEOI10_tower)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MAXN = 3e5+10; const int INF = 0x3f3f3f3f; const ll LINF = 1e15; const ll MOD = 1e9+9; inline mult(int a, int b){ return (1ll*a*b)%MOD; } inline sum(int a, int b){ return (a+b)%MOD; } void solve(){ int n, d; cin >> n >> d; vector<int> arr(n); for(int i=0;i<n;i++) cin >> arr[i]; sort(all(arr)); vector<int> opt(n); int low=0; for(int i=0;i<n;i++){ while(low<n && arr[low]+d<arr[i]) low++; opt[i]=i-low; } int ans=1; for(int i=0;i<n;i++) ans=mult(ans, opt[i]+1); cout << ans << "\n"; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // freopen("truth.in", "r", stdin); // freopen("truth.out", "w", stdout); int tt=1; // cin >> tt; while(tt--) solve(); return 0; }

Compilation message (stderr)

tower.cpp:22:8: error: ISO C++ forbids declaration of 'mult' with no type [-fpermissive]
   22 | inline mult(int a, int b){ return (1ll*a*b)%MOD; }
      |        ^~~~
tower.cpp:23:8: error: ISO C++ forbids declaration of 'sum' with no type [-fpermissive]
   23 | inline sum(int a, int b){ return (a+b)%MOD; }
      |        ^~~