# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
343944 | 2021-01-04T21:26:00 Z | kkk | 결혼 문제 (IZhO14_marriage) | C++14 | 1500 ms | 10092 KB |
#include<iostream> #include<cstring> #include<vector> #define endl '\n' using namespace std; vector <long long> v[300000]; bool used[3000]; long long br=0,le=0,m,bru=0; long long rec(long long pr,long long fi,long long bru) { if(pr>fi)return 0; long long rez=0; for(int i=0;i<v[pr].size();i++) { if(!used[v[pr][i]]) { if(pr==fi && bru==m-1)return 1; used[v[pr][i]]=1; rez+=rec(pr+1,fi,bru+1); used[v[pr][i]]=0; } rez+=rec(pr+1,fi,bru); } return rez; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n,k,i,a,b,p,j,brr=0; cin>>n>>m>>k; for(i=0;i<k;i++) { cin>>a>>b; v[a].push_back(b); le=a; } for(i=1;i<=n;i++) { for(j=i;j<=n;j++){ //cout<<rec(i,j,0)<<endl; if(rec(i,j,0)>0){brr++;} memset(used,0,sizeof(used)); } } cout<<brr<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 7404 KB | Output is correct |
2 | Incorrect | 5 ms | 7532 KB | Output isn't correct |
3 | Incorrect | 5 ms | 7404 KB | Output isn't correct |
4 | Incorrect | 5 ms | 7404 KB | Output isn't correct |
5 | Incorrect | 5 ms | 7404 KB | Output isn't correct |
6 | Incorrect | 6 ms | 7532 KB | Output isn't correct |
7 | Execution timed out | 1594 ms | 7404 KB | Time limit exceeded |
8 | Correct | 5 ms | 7404 KB | Output is correct |
9 | Correct | 5 ms | 7404 KB | Output is correct |
10 | Correct | 5 ms | 7404 KB | Output is correct |
11 | Correct | 5 ms | 7404 KB | Output is correct |
12 | Correct | 6 ms | 7404 KB | Output is correct |
13 | Incorrect | 5 ms | 7404 KB | Output isn't correct |
14 | Execution timed out | 1599 ms | 7404 KB | Time limit exceeded |
15 | Execution timed out | 1583 ms | 7404 KB | Time limit exceeded |
16 | Incorrect | 37 ms | 7404 KB | Output isn't correct |
17 | Execution timed out | 1574 ms | 7404 KB | Time limit exceeded |
18 | Execution timed out | 1597 ms | 7404 KB | Time limit exceeded |
19 | Execution timed out | 1599 ms | 7404 KB | Time limit exceeded |
20 | Execution timed out | 1599 ms | 7404 KB | Time limit exceeded |
21 | Execution timed out | 1594 ms | 7404 KB | Time limit exceeded |
22 | Execution timed out | 1588 ms | 7404 KB | Time limit exceeded |
23 | Execution timed out | 1555 ms | 7404 KB | Time limit exceeded |
24 | Execution timed out | 1552 ms | 7404 KB | Time limit exceeded |
25 | Execution timed out | 1560 ms | 7660 KB | Time limit exceeded |
26 | Execution timed out | 1581 ms | 7404 KB | Time limit exceeded |
27 | Correct | 1129 ms | 7532 KB | Output is correct |
28 | Execution timed out | 1552 ms | 7404 KB | Time limit exceeded |
29 | Execution timed out | 1550 ms | 7532 KB | Time limit exceeded |
30 | Execution timed out | 1597 ms | 7532 KB | Time limit exceeded |
31 | Execution timed out | 1572 ms | 8300 KB | Time limit exceeded |
32 | Execution timed out | 1556 ms | 7532 KB | Time limit exceeded |
33 | Correct | 106 ms | 7404 KB | Output is correct |
34 | Execution timed out | 1586 ms | 7404 KB | Time limit exceeded |
35 | Execution timed out | 1580 ms | 9196 KB | Time limit exceeded |
36 | Execution timed out | 1586 ms | 9068 KB | Time limit exceeded |
37 | Execution timed out | 1534 ms | 8428 KB | Time limit exceeded |
38 | Execution timed out | 1559 ms | 9708 KB | Time limit exceeded |
39 | Execution timed out | 1594 ms | 7532 KB | Time limit exceeded |
40 | Execution timed out | 1594 ms | 7660 KB | Time limit exceeded |
41 | Execution timed out | 1579 ms | 7916 KB | Time limit exceeded |
42 | Execution timed out | 1594 ms | 8172 KB | Time limit exceeded |
43 | Execution timed out | 1538 ms | 8428 KB | Time limit exceeded |
44 | Execution timed out | 1573 ms | 9196 KB | Time limit exceeded |
45 | Execution timed out | 1584 ms | 8300 KB | Time limit exceeded |
46 | Execution timed out | 1538 ms | 9836 KB | Time limit exceeded |
47 | Execution timed out | 1575 ms | 9708 KB | Time limit exceeded |
48 | Execution timed out | 1574 ms | 9580 KB | Time limit exceeded |
49 | Execution timed out | 1559 ms | 10092 KB | Time limit exceeded |
50 | Execution timed out | 1579 ms | 7532 KB | Time limit exceeded |