# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
946093 | 2024-03-14T10:11:51 Z | hariaakas646 | Skyscraper (JOI16_skyscraper) | C++17 | 930 ms | 186020 KB |
#include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, l, r) for(int i=l; i<r; i++) #define frange(i, l) forr(i, 0, l) #define pb push_back #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; typedef long long lli; typedef vector<vi> vvi; typedef vector<lli> vll; typedef vector<bool> vb; typedef set<int> seti; typedef multiset<int> mseti; void usaco() { freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin); // freopen("problem.out", "w", stdout); } const lli mod = 1e9 + 7; int main() { // usaco(); int n; scd(n); int l; scd(l); vector<vector<vll>> dp(1<<n, vector<vll>(n, vll(l+1, 0))); vi vec(n); frange(i, n) { scd(vec[i]); } frange(i, n) { dp[1<<i][i][0] = 1; } forr(i, 1, 1<<n) { frange(j, n) { frange(k, l+1) { if(dp[i][j][k]) continue; frange(e, n) { if(e != j && (i & (1<<e))) { int d = abs(vec[e] - vec[j]); if(k >= d) { dp[i][j][k] += dp[i^(1<<j)][e][k-d]; dp[i][j][k] %= mod; } } } } } } lli tot = 0; frange(j, n) { frange(k, l+1) { tot += dp[(1<<n)-1][j][k]; tot %= mod; } } printf("%lld\n", tot); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 436 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
5 | Correct | 35 ms | 15708 KB | Output is correct |
6 | Correct | 32 ms | 13916 KB | Output is correct |
7 | Correct | 7 ms | 2908 KB | Output is correct |
8 | Correct | 4 ms | 1628 KB | Output is correct |
9 | Correct | 33 ms | 14940 KB | Output is correct |
10 | Correct | 6 ms | 2492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 26968 KB | Output is correct |
2 | Correct | 930 ms | 182424 KB | Output is correct |
3 | Correct | 481 ms | 92648 KB | Output is correct |
4 | Correct | 908 ms | 186020 KB | Output is correct |
5 | Correct | 930 ms | 186020 KB | Output is correct |
6 | Correct | 927 ms | 175240 KB | Output is correct |
7 | Correct | 404 ms | 63916 KB | Output is correct |
8 | Correct | 455 ms | 88932 KB | Output is correct |
9 | Correct | 714 ms | 139348 KB | Output is correct |
10 | Correct | 833 ms | 160876 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 436 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
5 | Correct | 35 ms | 15708 KB | Output is correct |
6 | Correct | 32 ms | 13916 KB | Output is correct |
7 | Correct | 7 ms | 2908 KB | Output is correct |
8 | Correct | 4 ms | 1628 KB | Output is correct |
9 | Correct | 33 ms | 14940 KB | Output is correct |
10 | Correct | 6 ms | 2492 KB | Output is correct |
11 | Correct | 110 ms | 26968 KB | Output is correct |
12 | Correct | 930 ms | 182424 KB | Output is correct |
13 | Correct | 481 ms | 92648 KB | Output is correct |
14 | Correct | 908 ms | 186020 KB | Output is correct |
15 | Correct | 930 ms | 186020 KB | Output is correct |
16 | Correct | 927 ms | 175240 KB | Output is correct |
17 | Correct | 404 ms | 63916 KB | Output is correct |
18 | Correct | 455 ms | 88932 KB | Output is correct |
19 | Correct | 714 ms | 139348 KB | Output is correct |
20 | Correct | 833 ms | 160876 KB | Output is correct |
21 | Runtime error | 6 ms | 7772 KB | Execution killed with signal 11 |
22 | Halted | 0 ms | 0 KB | - |