QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#69051#5247. Walizki [C]wiktorlewicki0 3ms3540kbC++14790b2022-12-23 01:29:302022-12-23 01:29:33

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-23 01:29:33]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3540kb
  • [2022-12-23 01:29:30]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define int __int128_t
using namespace std;
const int N = 1e2 + 5;
vector<int> kraw[N];
ll n;
int dp[N], k[N];
int NWW(int a, int b){
	int res = a*b/__gcd(a, b);
	return res;
}
void dfs(int x){
	for(int i=2;i<=n;i++){
		dp[i]=0;
	}
	for(int i=1;i<=n;i++){
		if(k[i]&&dp[i]%k[i]){
			int pom = NWW(dp[i], k[i]);
			pom/=dp[i];
			dp[1]*=pom;
			dfs(1);
			return;
		}
	}
	for(auto v : kraw[x]){
		dp[v]+=(dp[x]/k[x]);
	}
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		long long x;
		cin>>x;
		k[i]=x;
		for(int j=1;j<=k[i];j++){
			long long a;
			cin>>a;
			kraw[i].pb(a);
		}
	}
	dp[1]=1;
	dfs(1);
	cout<<(ll)dp[1];
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 1
Accepted
time: 1ms
memory: 3420kb

input:

1
0

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

3
2 2 3
1 3
0

output:

2

result:

ok single line: '2'

Test #3:

score: -1
Wrong Answer
time: 0ms
memory: 3284kb

input:

5
4 2 3 4 5
3 3 4 5
2 4 5
1 5
0

output:

4

result:

wrong answer 1st lines differ - expected: '12', found: '4'

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 1
Accepted
time: 2ms
memory: 3284kb

input:

2
1 2
0

output:

1

result:

ok single line: '1'

Test #13:

score: -1
Wrong Answer
time: 2ms
memory: 3368kb

input:

4
3 2 3 4
2 3 4
1 4
0

output:

3

result:

wrong answer 1st lines differ - expected: '6', found: '3'

Subtask #3:

score: 0
Wrong Answer

Test #23:

score: 0
Wrong Answer
time: 1ms
memory: 3464kb

input:

11
10 2 3 4 5 6 7 8 9 10 11
9 3 4 5 6 7 8 9 10 11
8 4 5 6 7 8 9 10 11
7 5 6 7 8 9 10 11
6 6 7 8 9 10 11
5 7 8 9 10 11
4 8 9 10 11
3 9 10 11
2 10 11
1 11
0

output:

10

result:

wrong answer 1st lines differ - expected: '2520', found: '10'

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 0ms
memory: 3436kb

input:

12
11 2 3 4 5 6 7 8 9 10 11 12
10 3 4 5 6 7 8 9 10 11 12
9 4 5 6 7 8 9 10 11 12
8 5 6 7 8 9 10 11 12
7 6 7 8 9 10 11 12
6 7 8 9 10 11 12
5 8 9 10 11 12
4 9 10 11 12
3 10 11 12
2 11 12
1 12
0

output:

11

result:

wrong answer 1st lines differ - expected: '27720', found: '11'

Subtask #5:

score: 0
Wrong Answer

Test #45:

score: 0
Wrong Answer
time: 1ms
memory: 3440kb

input:

25
24 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
23 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
22 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
21 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
20 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...

output:

24

result:

wrong answer 1st lines differ - expected: '5354228880', found: '24'

Subtask #6:

score: 0
Wrong Answer

Test #56:

score: 0
Wrong Answer
time: 2ms
memory: 3424kb

input:

26
25 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
24 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
23 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
22 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
21 6 7 8 9 10 11 12 13 14 15 ...

output:

25

result:

wrong answer 1st lines differ - expected: '26771144400', found: '25'

Subtask #7:

score: 0
Wrong Answer

Test #67:

score: 0
Wrong Answer
time: 2ms
memory: 3540kb

input:

61
60 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
59 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 ...

output:

60

result:

wrong answer 1st lines differ - expected: '9690712164777231700912800', found: '60'

Subtask #8:

score: 0
Wrong Answer

Test #78:

score: 0
Wrong Answer
time: 2ms
memory: 3476kb

input:

62
61 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
60 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 ...

output:

61

result:

wrong answer 1st lines differ - expected: '591133442051411133755680800', found: '61'

Subtask #9:

score: 0
Wrong Answer

Test #89:

score: 0
Wrong Answer
time: 3ms
memory: 3476kb

input:

91
90 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
89 3 4 5 6 7 8 9 10 11 12 13 14 ...

output:

90

result:

wrong answer 1st lines differ - expected: '718766754945489455304472257065075294400', found: '90'

Subtask #10:

score: 0
Wrong Answer

Test #101:

score: 0
Wrong Answer
time: 3ms
memory: 3524kb

input:

92
91 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
90 3 4 5 6 7 8 9 10 11 12 13 ...

output:

91

result:

wrong answer 1st lines differ - expected: '718766754945489455304472257065075294400', found: '91'