Submission #1163550
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
int N, M;
vector<int> E[10101];
int MM[10101];
//-----------------------------------------------------------------
int main() {
cin >> N >> M;
rep(i, 0, M) {
int a, b; scanf("%d%d", &a, &b);
E[b].push_back(a);
MM[a]++;
}
vector<double> dp(N + 1, 0);
rep(t, 0, 10000) {
vector<double> pd(N + 1, 0);
rep(i, 1, N + 1) {
pd[i] = 0.1;
for (int j : E[i]) pd[i] += 0.9 * dp[j] / MM[j];
}
swap(dp, pd);
}
rep(i, 1, N + 1) printf("%.10f\n", dp[i]);
}
Submission Info
Submission Time
2017-03-16 14:24:44+0900
Task
E - Page Rank
User
hamayanhamayan
Language
C++14 (GCC 5.4.1)
Score
100
Code Size
591 Byte
Status
AC
Exec Time
747 ms
Memory
1024 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:14:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int a, b; scanf("%d%d", &a, &b);
^
Judge Result
Set Name
All
Score / Max Score
100 / 100
Status
Set Name
Test Cases
All
10_sample_01.txt, 10_sample_02.txt, 20-random_small-00.txt, 20-random_small-01.txt, 20-random_small-02.txt, 20-random_small-03.txt, 20-random_small-04.txt, 20-random_small-05.txt, 20-random_small-06.txt, 20-random_small-07.txt, 20-random_small-08.txt, 20-random_small-09.txt, 30-random_large-00.txt, 30-random_large-01.txt, 30-random_large-02.txt, 30-random_large-03.txt, 30-random_large-04.txt, 30-random_large-05.txt, 30-random_large-06.txt, 30-random_large-07.txt, 30-random_large-08.txt, 30-random_large-09.txt, 40-random_max-00.txt, 40-random_max-01.txt, 40-random_max-02.txt
Case Name
Status
Exec Time
Memory
10_sample_01.txt
AC
2 ms
512 KB
10_sample_02.txt
AC
2 ms
512 KB
20-random_small-00.txt
AC
53 ms
512 KB
20-random_small-01.txt
AC
46 ms
512 KB
20-random_small-02.txt
AC
4 ms
512 KB
20-random_small-03.txt
AC
70 ms
512 KB
20-random_small-04.txt
AC
8 ms
512 KB
20-random_small-05.txt
AC
30 ms
512 KB
20-random_small-06.txt
AC
7 ms
512 KB
20-random_small-07.txt
AC
78 ms
512 KB
20-random_small-08.txt
AC
68 ms
512 KB
20-random_small-09.txt
AC
13 ms
512 KB
30-random_large-00.txt
AC
33 ms
512 KB
30-random_large-01.txt
AC
137 ms
512 KB
30-random_large-02.txt
AC
392 ms
896 KB
30-random_large-03.txt
AC
391 ms
768 KB
30-random_large-04.txt
AC
135 ms
640 KB
30-random_large-05.txt
AC
264 ms
640 KB
30-random_large-06.txt
AC
159 ms
640 KB
30-random_large-07.txt
AC
233 ms
640 KB
30-random_large-08.txt
AC
561 ms
896 KB
30-random_large-09.txt
AC
635 ms
896 KB
40-random_max-00.txt
AC
742 ms
1024 KB
40-random_max-01.txt
AC
746 ms
1024 KB
40-random_max-02.txt
AC
747 ms
1024 KB