# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
329816 | 2020-11-22T16:33:43 Z | theshadow_04 | Skyscraper (JOI16_skyscraper) | C++14 | 2000 ms | 384 KB |
// V T An #include <bits/stdc++.h> #define F first #define S second #define MOD 1000000007 #define pb push_back #define ll long long #define Task "SKYSCRAPER" using namespace std; const int maxn = 100005; int n, a[maxn], L; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); if(fopen(Task".inp", "r")){ freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> L; vector<int> v; for(int i = 1; i <= n; ++i) cin >> a[i], v.pb(i); int ans = 0; do { long long res = 0; for(int i = 0; i < v.size() - 1; ++ i) res += abs(a[v[i + 1]] - a[v[i]]); if(res <= L) ++ ans; if(ans > MOD) ans -= MOD; } while(next_permutation(v.begin(), v.end())); cout << ans; } // CHY-AKAV
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2085 ms | 364 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Execution timed out | 2085 ms | 364 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |