Submission #12941

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
129412015-01-21 06:22:34model_code스파이 (JOI13_spy)C++98
100 / 100
312 ms32424 KiB
#include <cstdio>
#include <algorithm>
#define MAXN 2000
#define MAXN2 4000
#define MAXM 500000
using namespace std;
int N,M;
int Pa,Qa;
int Rb,Sb;
int parenti[MAXN];
int parentj[MAXN];
int shachoi;
int shachoj;
int cnt[MAXN][MAXN];
int memo[MAXN][MAXN];
int memo_dp(int j,int i){
if(memo[j][i]!=-1){return memo[j][i];}
memo[j][i]=cnt[j][i];
if(j!=shachoj){memo[j][i]+=memo_dp(parentj[j],i);}
if(i!=shachoi){memo[j][i]+=memo_dp(j,parenti[i]);}
if(j!=shachoj&&i!=shachoi){memo[j][i]-=memo_dp(parentj[j],parenti[i]);}
return memo[j][i];
}
int main(){
scanf("%d %d\n",&N,&M);
for(int a=0;a<N;a++){
scanf("%d %d\n",&Pa,&Qa);
if(Pa!=0){
Pa--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...