# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
704147 | 2023-03-01T17:23:07 Z | karrigan | 스파이 (JOI13_spy) | C++14 | 388 ms | 36184 KB |
#include<bits/stdc++.h> using namespace std; int tme=0; int in[2009]; int out[2009]; int a[2009]; int b[2009]; int num[2009][2009]; int dp[2009][2009];; int cal(int i,int j){ if (!i||!j)return 0; if (num[i][j])return dp[i][j]; num[i][j]=1; return dp[i][j]+=cal(i,b[j])+cal(a[i],j)-cal(a[i],b[j]); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int r1=0,r2=0; int n,m; cin>>n>>m; for (int i=1;i<=n;i++){ cin>>a[i]>>b[i]; } for (int i=1;i<=m;i++){ int x,y; cin>>x>>y; dp[x][y]++; } for (int i=1;i<=n;i++){ cout<<cal(i,i)<<'\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2260 KB | Output is correct |
2 | Correct | 2 ms | 2252 KB | Output is correct |
3 | Correct | 1 ms | 1988 KB | Output is correct |
4 | Correct | 1 ms | 2004 KB | Output is correct |
5 | Correct | 2 ms | 2132 KB | Output is correct |
6 | Correct | 2 ms | 2120 KB | Output is correct |
7 | Correct | 2 ms | 2260 KB | Output is correct |
8 | Correct | 2 ms | 2132 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 326 ms | 31828 KB | Output is correct |
2 | Correct | 310 ms | 32004 KB | Output is correct |
3 | Correct | 15 ms | 24276 KB | Output is correct |
4 | Correct | 17 ms | 24460 KB | Output is correct |
5 | Correct | 22 ms | 31800 KB | Output is correct |
6 | Correct | 25 ms | 31784 KB | Output is correct |
7 | Correct | 203 ms | 31844 KB | Output is correct |
8 | Correct | 36 ms | 31820 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 388 ms | 31868 KB | Output is correct |
2 | Correct | 338 ms | 36172 KB | Output is correct |
3 | Correct | 103 ms | 28552 KB | Output is correct |
4 | Correct | 88 ms | 32684 KB | Output is correct |
5 | Correct | 105 ms | 36172 KB | Output is correct |
6 | Correct | 82 ms | 35556 KB | Output is correct |
7 | Correct | 267 ms | 36184 KB | Output is correct |
8 | Correct | 131 ms | 36144 KB | Output is correct |