Submission #388496

# Submission time Handle Problem Language Result Execution time Memory
388496 2021-04-11T17:51:46 Z shawon_majid A Huge Tower (CEOI10_tower) C++14
5 / 100
1000 ms 5196 KB
//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 time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 386 ms 280 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 332 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 2256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 5196 KB Time limit exceeded
2 Halted 0 ms 0 KB -