답안 #199468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199468 2020-02-01T13:29:16 Z TadijaSebez File Paths (BOI15_fil) C++11
0 / 100
23 ms 3960 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=6050;
const int K=1000050;
int par[N],len[N],dep[N];
vector<int> E[N];
int can[K];
int main(){
	int n,m,k,s;
	scanf("%i %i %i %i",&n,&m,&k,&s);
	dep[0]=1;par[0]=-1;
	for(int i=1;i<=n+m;i++){
		scanf("%i %i",&par[i],&len[i]);
		E[par[i]].pb(i);
		dep[i]=dep[par[i]]+len[i]+(i<=n);
		if(i<=n && dep[i]<K)can[dep[i]]++;
	}
	for(int i=1;i<=m;i++){
		bool ok=0;
		if(k==dep[n+i])ok=1;
		//for(int j=1;j<=n;j++)if(dep[j]+dep[n+i]+s+1==k)ok=1;
		for(int j=par[n+i];j!=-1;j=par[j])if(k-dep[n+i]+dep[j]-s-1>=0 && can[k-dep[n+i]+dep[j]-s-1])ok=1;
		if(ok)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Compilation message

fil.cpp: In function 'int main()':
fil.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i %i %i",&n,&m,&k,&s);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
fil.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%i %i",&par[i],&len[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3704 KB Output is correct
2 Correct 10 ms 3704 KB Output is correct
3 Correct 10 ms 3704 KB Output is correct
4 Correct 10 ms 3720 KB Output is correct
5 Incorrect 23 ms 3960 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -