Submission #388496

#TimeUsernameProblemLanguageResultExecution timeMemory
388496shawon_majidA Huge Tower (CEOI10_tower)C++14
5 / 100
1093 ms5196 KiB
//Bismillahir Rahman-ir Rahim #include <bits/stdc++.h> using namespace std; #define debug(x) cout << '>' << #x << " : " << x << endl; #define all(c) c.begin(), c.end() #define F first #define S second typedef unsigned long long ull; typedef long long ll; int main() { int n, limit; cin >> n >> limit; vector<pair <int, int> > ara(n); for(int i = 0; i < n; i++){ cin >> ara[i].F; ara[i].S = i; } int ans = 0; do{ bool f = 1; // for(int i = 0; i < n; i++) cout << ara[i].F << " "; // cout << endl; for(int i = 0; i < n-1; i++){ if(ara[i].F +limit < ara[i+1].F){ f = 0; } } if(f) ans++; }while(next_permutation(all(ara))); cout << ans << endl; return 0; }
#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...